CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
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>
27#include "CLHEP/GenericFunctions/AbsParameter.hh"
28
29namespace Genfun {
30
31 /**
32 * @author
33 * @ingroup genfun
34 */
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 };
93std::ostream & operator << ( std::ostream & o, const Parameter &p);
94} // namespace Genfun
95
96#endif
#define PARAMETER_OBJECT_DEF(classname)
Definition: AbsParameter.hh:79
const Parameter & operator=(const Parameter &right)
Definition: Parameter.cc:117
const std::string & getName() const
Definition: Parameter.cc:25
void setLowerLimit(double lowerLimit)
Definition: Parameter.cc:71
virtual double getValue() const
Definition: Parameter.cc:29
void connectFrom(const AbsParameter *source)
Definition: Parameter.cc:95
virtual Parameter * parameter()
Definition: Parameter.hh:81
double getLowerLimit() const
Definition: Parameter.cc:39
void setUpperLimit(double upperLimit)
Definition: Parameter.cc:83
double getUpperLimit() const
Definition: Parameter.cc:49
virtual ~Parameter()
Definition: Parameter.cc:15
virtual const Parameter * parameter() const
Definition: Parameter.hh:82
void setValue(double value)
Definition: Parameter.cc:59
Definition: Abs.hh:14
std::ostream & operator<<(std::ostream &os, const Argument &a)
Definition: Argument.hh:81