Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:34

0001 // -*- C++ -*-
0002 // $Id: AbsParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 #ifndef _AbsParameter_h_
0004 #define _AbsParameter_h_
0005 
0006 namespace Genfun {
0007   class Parameter;
0008   class ParameterSum;
0009   class ParameterDifference;
0010   class ParameterProduct;
0011   class ParameterQuotient;
0012   class ParameterNegation;
0013   class ConstPlusParameter;
0014   class ConstMinusParameter;
0015   class ConstTimesParameter;
0016   class ConstOverParameter;
0017 
0018   /**
0019    * @author
0020    * @ingroup genfun
0021    */
0022   class AbsParameter {
0023     
0024   public:
0025     
0026     // Default Constructor
0027     AbsParameter();
0028     
0029     // Copy constructor:
0030     AbsParameter(const AbsParameter &);
0031 
0032     // Destructor
0033     virtual ~AbsParameter();
0034   
0035     // Parameter value
0036     virtual double getValue()  const=0;   
0037 
0038     // Every parameter must override this:
0039     AbsParameter * clone() const;
0040 
0041     // Extra lingual type information:
0042     virtual Parameter *parameter() {return 0;}
0043     virtual const Parameter *parameter() const {return 0;}
0044 
0045   private:
0046 
0047     // Cannot assign an AbsParameter:
0048     AbsParameter & operator= (const AbsParameter &);
0049 
0050     virtual AbsParameter *_clone() const=0;
0051 
0052   };
0053 
0054 // Now for some additional operations:
0055 
0056 
0057 ConstTimesParameter               operator * (double c, const AbsParameter &op2);
0058 ConstPlusParameter                operator + (double c, const AbsParameter &op2);
0059 ConstMinusParameter               operator - (double c, const AbsParameter &op2);
0060 ConstOverParameter                operator / (double c, const AbsParameter &op2);
0061 
0062 ConstTimesParameter               operator * (const AbsParameter &op2, double c);
0063 ConstPlusParameter                operator + (const AbsParameter &op2, double c);
0064 ConstPlusParameter                operator - (const AbsParameter &op2, double c);
0065 ConstTimesParameter               operator / (const AbsParameter &op2, double c);
0066 
0067 
0068 ParameterProduct                  operator * (const AbsParameter &op1, const AbsParameter &op2);
0069 ParameterSum                      operator + (const AbsParameter &op1, const AbsParameter &op2);
0070 ParameterDifference               operator - (const AbsParameter &op1, const AbsParameter &op2);
0071 ParameterQuotient                 operator / (const AbsParameter &op1, const AbsParameter &op2);
0072 ParameterNegation                 operator - (const AbsParameter &op1);
0073 
0074 typedef const AbsParameter & GENPARAMETER;
0075 
0076 } // namespace Genfun   
0077 
0078 // Poor man's covariant return type:
0079 #define PARAMETER_OBJECT_DEF(classname)              \
0080 public:                                              \
0081   classname *clone() const;                          \
0082 private:                                             \
0083   virtual AbsParameter* _clone() const;
0084 
0085 // Poor man's covariant return type:  
0086 #define PARAMETER_OBJECT_IMP(classname)              \
0087 classname *classname::clone () const {               \
0088   return (classname *) _clone();                     \
0089 }                                                    \
0090 AbsParameter *classname::_clone () const {           \
0091   return new classname(*this);                       \
0092 }
0093 
0094 
0095 #include "CLHEP/GenericFunctions/ParameterProduct.hh"
0096 #include "CLHEP/GenericFunctions/ParameterSum.hh"
0097 #include "CLHEP/GenericFunctions/ParameterDifference.hh"
0098 #include "CLHEP/GenericFunctions/ParameterQuotient.hh"
0099 #include "CLHEP/GenericFunctions/ParameterNegation.hh"
0100 #include "CLHEP/GenericFunctions/ConstPlusParameter.hh"
0101 #include "CLHEP/GenericFunctions/ConstMinusParameter.hh"
0102 #include "CLHEP/GenericFunctions/ConstTimesParameter.hh"
0103 #include "CLHEP/GenericFunctions/ConstOverParameter.hh"
0104 
0105 #endif