CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

GenericFunctions/Parameter.hh
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: Parameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3 //-----------------------Class Parameter------------------------------------//
4 // //
5 // Joe Boudreau //
6 // Petar Maksimovic //
7 // November 1999 //
8 // //
9 // This class is a simple low-level double precision number, together with //
10 // some limiting values. It is designed essentially as an ingredient for //
11 // building function objects. //
12 // //
13 // Parameters can be connnected to one another. If a parameter is //
14 // connected, it takes is value (and limits) from the parameter to which //
15 // it is connected. //
16 // When disconnected, it captures the values of the connected field before //
17 // dropping the connection. An attempt to alter the values of the field //
18 // while the Parameter is connected to another parameter will result in //
19 // an obnoxious warning mesage. //
20 // //
21 //--------------------------------------------------------------------------//
22 #ifndef Parameter_h
23 #define Parameter_h 1
24 
25 #include <string>
26 #include <iostream>
28 
29 namespace Genfun {
30 
35  class Parameter:public AbsParameter {
36 
38 
39  public:
40 
41  // Constructor.
42  Parameter(std::string name,
43  double value,
44  double lowerLimit=-1e100,
45  double upperLimit= 1e100);
46 
47  // Copy constructor
48  Parameter(const Parameter & right);
49 
50  // Destructor
51  virtual ~Parameter();
52 
53  // Assignment
54  const Parameter & operator=(const Parameter &right);
55 
56  // Accessor for the Parameter name
57  const std::string & getName() const;
58 
59  // Accessor for value
60  virtual double getValue() const;
61 
62  // Accessor for Lower Limit
63  double getLowerLimit() const;
64 
65  // Accessor for Upper Limit
66  double getUpperLimit() const;
67 
68  // Set Value
69  void setValue(double value);
70 
71  // Set Lower Limit
72  void setLowerLimit(double lowerLimit);
73 
74  // Set Upper Limit
75  void setUpperLimit(double upperLimit);
76 
77  // Take values + limits from some other parameter.
78  void connectFrom(const AbsParameter * source);
79 
80  // Extra lingual type information:
81  virtual Parameter *parameter() {return this;}
82  virtual const Parameter *parameter() const {return this;}
83 
84  private:
85 
86  std::string _name ; // name
87  double _value; // value
88  double _lowerLimit; // lower limit
89  double _upperLimit; // upper limit
90  const AbsParameter *_sourceParameter; // connection
91 
92  };
93 std::ostream & operator << ( std::ostream & o, const Parameter &p);
94 } // namespace Genfun
95 
96 #endif
Genfun::Parameter::getValue
virtual double getValue() const
Definition: Parameter.cc:27
Genfun::Parameter::setUpperLimit
void setUpperLimit(double upperLimit)
Definition: Parameter.cc:81
Genfun::Parameter::getUpperLimit
double getUpperLimit() const
Definition: Parameter.cc:47
Genfun::Parameter::setLowerLimit
void setLowerLimit(double lowerLimit)
Definition: Parameter.cc:69
Genfun::Parameter::getName
const std::string & getName() const
Definition: Parameter.cc:23
Genfun::operator<<
std::ostream & operator<<(std::ostream &os, const Argument &a)
Definition: CLHEP/GenericFunctions/Argument.hh:81
PARAMETER_OBJECT_DEF
#define PARAMETER_OBJECT_DEF(classname)
Definition: CLHEP/GenericFunctions/AbsParameter.hh:79
Genfun::Parameter::parameter
virtual Parameter * parameter()
Definition: GenericFunctions/Parameter.hh:81
AbsParameter.hh
Genfun::AbsParameter
Definition: CLHEP/GenericFunctions/AbsParameter.hh:22
Genfun::Parameter::operator=
const Parameter & operator=(const Parameter &right)
Definition: Parameter.cc:115
Genfun::Parameter::connectFrom
void connectFrom(const AbsParameter *source)
Definition: Parameter.cc:93
Genfun::Parameter::parameter
virtual const Parameter * parameter() const
Definition: GenericFunctions/Parameter.hh:82
Genfun::Parameter::getLowerLimit
double getLowerLimit() const
Definition: Parameter.cc:37
Genfun::Parameter::Parameter
Parameter(std::string name, double value, double lowerLimit=-1e100, double upperLimit=1e100)
Definition: Parameter.cc:8
Genfun::AbsParameter::AbsParameter
AbsParameter()
Definition: AbsParameter.cc:8
Genfun::Parameter::~Parameter
virtual ~Parameter()
Definition: Parameter.cc:13
Genfun::Parameter
Definition: CLHEP/GenericFunctions/Parameter.hh:35
Genfun::Parameter::setValue
void setValue(double value)
Definition: Parameter.cc:57
name
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno whether or not they are still since the user counter was last ZMerrno name() gives the(string) name of the latest recorded exception
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14