CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/Utilities/interface/Parameter.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Parameter_h
00002 #define PhysicsTools_Parameter_h
00003 #include <string>
00004 #include <boost/shared_ptr.hpp>
00005 #include <ostream>
00006 
00007 namespace funct {
00008   class Parameter {
00009   public:
00010     explicit Parameter(const std::string & name ="undefined" , double value = 0) :
00011       name_(name), value_(new double(value)) {
00012     }
00013     const std::string & name() const { return name_; }
00014     double value() const { return *value_; }
00015     double operator()() const { return *value_; }
00016     operator double() const { return value(); }
00017     double operator()(double) const { return *value_; }
00018     double operator()(double, double) const { return *value_; }
00019     boost::shared_ptr<double> ptr() const { return value_; }
00020     operator boost::shared_ptr<double>() const { return value_; }
00021     Parameter & operator=(double value) { *value_ = value; return * this; }
00022   private:
00023     std::string name_;
00024     boost::shared_ptr<double> value_;
00025   };
00026 
00027   inline std::ostream & operator<<(std::ostream&cout, const funct::Parameter & p) {
00028     return cout << p.name() <<" = " << p.value();
00029   }
00030 
00031 }
00032 
00033 #endif