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

CLHEP/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
#define PARAMETER_OBJECT_DEF(classname)
const Parameter & operator=(const Parameter &right)
Definition: Parameter.cc:115
const std::string & getName() const
Definition: Parameter.cc:23
void setLowerLimit(double lowerLimit)
Definition: Parameter.cc:69
virtual double getValue() const
Definition: Parameter.cc:27
void connectFrom(const AbsParameter *source)
Definition: Parameter.cc:93
virtual const Parameter * parameter() const
double getLowerLimit() const
Definition: Parameter.cc:37
void setUpperLimit(double upperLimit)
Definition: Parameter.cc:81
double getUpperLimit() const
Definition: Parameter.cc:47
virtual ~Parameter()
Definition: Parameter.cc:13
Parameter(std::string name, double value, double lowerLimit=-1e100, double upperLimit=1e100)
Definition: Parameter.cc:8
void setValue(double value)
Definition: Parameter.cc:57
std::ostream & operator<<(std::ostream &os, const Argument &a)