CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Parameter.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Parameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
00003 //-----------------------Class Parameter------------------------------------//
00004 //                                                                          //
00005 //  Joe Boudreau                                                            //
00006 //  Petar Maksimovic                                                        //
00007 //  November 1999                                                           //
00008 //                                                                          //
00009 //  This class is a simple low-level double precision number, together with //
00010 //  some limiting values. It is designed essentially as an ingredient for   //
00011 //  building function objects.                                              //
00012 //                                                                          //
00013 //  Parameters can be connnected to one another. If a parameter is          //
00014 //  connected, it takes is value (and limits) from the parameter to which   //
00015 //  it is connected.                                                        //
00016 //  When disconnected, it captures the values of the connected field before //
00017 //  dropping the connection.  An attempt to alter the values of the field   //
00018 //  while the Parameter is connected to another parameter will result in    //
00019 //  an obnoxious warning mesage.                                            //
00020 //                                                                          //
00021 //--------------------------------------------------------------------------//
00022 #ifndef Parameter_h
00023 #define Parameter_h 1
00024 
00025 #include <string>
00026 #include <iostream>
00027 #include "CLHEP/GenericFunctions/AbsParameter.hh"
00028 
00029 namespace Genfun {
00030 
00035   class Parameter:public AbsParameter {
00036 
00037     PARAMETER_OBJECT_DEF(Parameter)
00038   
00039       public:
00040   
00041     // Constructor.
00042     Parameter(std::string name,
00043               double value, 
00044               double lowerLimit=-1e100,
00045               double upperLimit= 1e100);
00046   
00047     // Copy constructor
00048     Parameter(const Parameter & right);
00049   
00050     // Destructor
00051     virtual ~Parameter();
00052 
00053     // Assignment
00054     const Parameter & operator=(const Parameter &right);
00055   
00056     // Accessor for the Parameter name
00057     const std::string & getName() const;
00058 
00059     // Accessor for value
00060     virtual double getValue() const;
00061   
00062     // Accessor for Lower Limit
00063     double getLowerLimit() const;
00064   
00065     // Accessor for Upper Limit
00066     double getUpperLimit() const;
00067   
00068     // Set Value
00069     void setValue(double value);
00070   
00071     // Set Lower Limit
00072     void setLowerLimit(double lowerLimit);
00073   
00074     // Set Upper Limit
00075     void setUpperLimit(double upperLimit);
00076   
00077     // Take values + limits from some other parameter.
00078     void connectFrom(const AbsParameter *  source);
00079   
00080     // Extra lingual type information:
00081     virtual Parameter *parameter() {return this;}
00082     virtual const Parameter *parameter() const {return this;}
00083   
00084   private:
00085 
00086     std::string        _name ;                // name
00087     double                _value;                // value
00088     double                _lowerLimit;           // lower limit
00089     double                _upperLimit;           // upper limit
00090     const AbsParameter   *_sourceParameter;      // connection
00091   
00092   };
00093 std::ostream & operator << ( std::ostream & o, const Parameter &p);
00094 } // namespace Genfun
00095 
00096 #endif

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7