CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
AbsParameter.hh
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: AbsParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3#ifndef _AbsParameter_h_
4#define _AbsParameter_h_
5
6namespace Genfun {
7 class Parameter;
8 class ParameterSum;
9 class ParameterDifference;
10 class ParameterProduct;
11 class ParameterQuotient;
12 class ParameterNegation;
13 class ConstPlusParameter;
14 class ConstMinusParameter;
15 class ConstTimesParameter;
16 class ConstOverParameter;
17
18 /**
19 * @author
20 * @ingroup genfun
21 */
23
24 public:
25
26 // Default Constructor
28
29 // Copy constructor:
31
32 // Destructor
33 virtual ~AbsParameter();
34
35 // Parameter value
36 virtual double getValue() const=0;
37
38 // Every parameter must override this:
39 AbsParameter * clone() const;
40
41 // Extra lingual type information:
42 virtual Parameter *parameter() {return 0;}
43 virtual const Parameter *parameter() const {return 0;}
44
45 private:
46
47 // Cannot assign an AbsParameter:
48 AbsParameter & operator= (const AbsParameter &);
49
50 virtual AbsParameter *_clone() const=0;
51
52 };
53
54// Now for some additional operations:
55
56
57ConstTimesParameter operator * (double c, const AbsParameter &op2);
58ConstPlusParameter operator + (double c, const AbsParameter &op2);
59ConstMinusParameter operator - (double c, const AbsParameter &op2);
60ConstOverParameter operator / (double c, const AbsParameter &op2);
61
62ConstTimesParameter operator * (const AbsParameter &op2, double c);
63ConstPlusParameter operator + (const AbsParameter &op2, double c);
64ConstPlusParameter operator - (const AbsParameter &op2, double c);
65ConstTimesParameter operator / (const AbsParameter &op2, double c);
66
67
68ParameterProduct operator * (const AbsParameter &op1, const AbsParameter &op2);
69ParameterSum operator + (const AbsParameter &op1, const AbsParameter &op2);
70ParameterDifference operator - (const AbsParameter &op1, const AbsParameter &op2);
71ParameterQuotient operator / (const AbsParameter &op1, const AbsParameter &op2);
72ParameterNegation operator - (const AbsParameter &op1);
73
74typedef const AbsParameter & GENPARAMETER;
75
76} // namespace Genfun
77
78// Poor man's covariant return type:
79#define PARAMETER_OBJECT_DEF(classname) \
80public: \
81 classname *clone() const; \
82private: \
83 virtual AbsParameter* _clone() const;
84
85// Poor man's covariant return type:
86#define PARAMETER_OBJECT_IMP(classname) \
87classname *classname::clone () const { \
88 return (classname *) _clone(); \
89} \
90AbsParameter *classname::_clone () const { \
91 return new classname(*this); \
92}
93
94
95#include "CLHEP/GenericFunctions/ParameterProduct.hh"
96#include "CLHEP/GenericFunctions/ParameterSum.hh"
97#include "CLHEP/GenericFunctions/ParameterDifference.hh"
98#include "CLHEP/GenericFunctions/ParameterQuotient.hh"
99#include "CLHEP/GenericFunctions/ParameterNegation.hh"
100#include "CLHEP/GenericFunctions/ConstPlusParameter.hh"
101#include "CLHEP/GenericFunctions/ConstMinusParameter.hh"
102#include "CLHEP/GenericFunctions/ConstTimesParameter.hh"
103#include "CLHEP/GenericFunctions/ConstOverParameter.hh"
104
105#endif
virtual double getValue() const =0
virtual const Parameter * parameter() const
Definition: AbsParameter.hh:43
AbsParameter * clone() const
Definition: AbsParameter.cc:17
virtual Parameter * parameter()
Definition: AbsParameter.hh:42
Definition: Abs.hh:14
FunctionQuotient operator/(const AbsFunction &op1, const AbsFunction &op2)
Definition: AbsFunction.cc:67
FunctionSum operator+(const AbsFunction &op1, const AbsFunction &op2)
Definition: AbsFunction.cc:55
FunctionProduct operator*(const AbsFunction &op1, const AbsFunction &op2)
Definition: AbsFunction.cc:63
const AbsParameter & GENPARAMETER
Definition: AbsParameter.hh:74
FunctionDifference operator-(const AbsFunction &op1, const AbsFunction &op2)
Definition: AbsFunction.cc:59