CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Parameter.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Parameter_h
2 #define PhysicsTools_Parameter_h
3 #include <string>
4 #include <boost/shared_ptr.hpp>
5 #include <ostream>
6 
7 namespace funct {
8  class Parameter {
9  public:
10  explicit Parameter(const std::string & name ="undefined" , double value = 0) :
11  name_(name), value_(new double(value)) {
12  }
13  const std::string & name() const { return name_; }
14  double value() const { return *value_; }
15  double operator()() const { return *value_; }
16  operator double() const { return value(); }
17  double operator()(double) const { return *value_; }
18  double operator()(double, double) const { return *value_; }
19  boost::shared_ptr<double> ptr() const { return value_; }
20  operator boost::shared_ptr<double>() const { return value_; }
21  Parameter & operator=(double value) { *value_ = value; return * this; }
22  private:
24  boost::shared_ptr<double> value_;
25  };
26 
27  inline std::ostream & operator<<(std::ostream&cout, const funct::Parameter & p) {
28  return cout << p.name() <<" = " << p.value();
29  }
30 
31 }
32 
33 #endif
Parameter & operator=(double value)
Definition: Parameter.h:21
const std::string & name() const
Definition: Parameter.h:13
boost::shared_ptr< double > ptr() const
Definition: Parameter.h:19
std::string name_
Definition: Parameter.h:23
Parameter(const std::string &name="undefined", double value=0)
Definition: Parameter.h:10
double operator()() const
Definition: Parameter.h:15
boost::shared_ptr< double > value_
Definition: Parameter.h:24
double operator()(double, double) const
Definition: Parameter.h:18
double operator()(double) const
Definition: Parameter.h:17
tuple cout
Definition: gather_cfg.py:145
static const int p
Definition: Factorize.h:57
std::ostream & operator<<(std::ostream &cout, const Expression &e)
Definition: Expression.h:39
double value() const
Definition: Parameter.h:14