GeoModel - GeoModelCore
Parameter.h
1 //==========================================================================//
2 // Imported from the QAT library (qat.pitt.edu) by the copyright holder //
3 // Joe Boudreau. Software licensed under the terms and conditions of the //
4 // GNU Lesser Public License v3. //
5 //==========================================================================//
6 
7 //-----------------------Class Parameter------------------------------------//
8 // //
9 // //
10 // This class is a simple low-level double precision number, together with //
11 // some limiting values. It is designed essentially as an ingredient for //
12 // building function objects. //
13 // //
14 // Parameters can be connnected to one another. If a parameter is //
15 // connected, it takes is value (and limits) from the parameter to which //
16 // it is connected. //
17 // When disconnected, it captures the values of the connected field before //
18 // dropping the connection. An attempt to alter the values of the field //
19 // while the Parameter is connected to another parameter will result in //
20 // an obnoxious warning mesage. //
21 // //
22 //--------------------------------------------------------------------------//
23 #ifndef Parameter_h
24 #define Parameter_h 1
25 
26 #include <string>
27 #include <iostream>
28 #include "GeoGenericFunctions/AbsParameter.h"
29 
30 namespace GeoGenfun {
31 
32  class Parameter:public AbsParameter {
33 
34  PARAMETER_OBJECT_DEF(Parameter)
35 
36  public:
37 
38  // Constructor.
39  Parameter(std::string name,
40  double value,
41  double lowerLimit=-1e100,
42  double upperLimit= 1e100);
43 
44  // Copy constructor
45  Parameter(const Parameter & right);
46 
47  // Destructor
48  virtual ~Parameter();
49 
50  // Assignment
51  const Parameter & operator=(const Parameter &right);
52 
53  // Accessor for the Parameter name
54  const std::string & getName() const;
55 
56  // Accessor for value
57  virtual double getValue() const;
58 
59  // Accessor for Lower Limit
60  double getLowerLimit() const;
61 
62  // Accessor for Upper Limit
63  double getUpperLimit() const;
64 
65  // Set Value
66  void setValue(double value);
67 
68  // Set Lower Limit
69  void setLowerLimit(double lowerLimit);
70 
71  // Set Upper Limit
72  void setUpperLimit(double upperLimit);
73 
74  // Take values + limits from some other parameter.
75  void connectFrom(const AbsParameter * source);
76 
77  // Extra lingual type information:
78  virtual Parameter *parameter() {return this;}
79  virtual const Parameter *parameter() const {return this;}
80 
81  private:
82 
83  std::string _name ; // name
84  double _value; // value
85  double _lowerLimit; // lower limit
86  double _upperLimit; // upper limit
87  const AbsParameter *_sourceParameter; // connection
88 
89  };
90 std::ostream & operator << ( std::ostream & o, const Parameter &p);
91 } // namespace Genfun
92 
93 #endif
Definition: Abs.h:15