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

GenericFunctions/Variable.hh
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: Variable.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3 //----------------------X------------ --------------------------------------//
4 // //
5 // Class Variable //
6 // Joe Boudreau, Petar Maksimovic, Nov. 1999 //
7 // //
8 // Variable is a function that returns the variable itself. //
9 //--------------------------------------------------------------------------//
10 #ifndef Variable_h
11 #define Variable_h 1
13 namespace Genfun {
14 
19  class Variable : public AbsFunction {
20 
22 
23  public:
24 
25  // Constructor
26  Variable(unsigned int selectionIndex=0,
27  unsigned int dimensionality=1);
28 
29  // Copy constructor
30  Variable(const Variable &right);
31 
32  // Destructor
33  virtual ~Variable();
34 
35  // Retrieve function value
36  virtual double operator ()(double argument) const;
37  virtual double operator ()(const Argument & a) const;
38 
39  // Get the dimensionality, as specified in the constructor:
40  virtual unsigned int dimensionality() const ;
41 
42  // Get the selectionIndex:
43  unsigned int index() const;
44 
45  // Derivative.
46  Derivative partial (unsigned int) const;
47 
48  // Does this function have an analytic derivative?
49  virtual bool hasAnalyticDerivative() const {return true;}
50 
51  private:
52 
53  // It is illegal to assign a fixed constant
54  const Variable & operator=(const Variable &right);
55 
56  // The selection index is used to select a particular element from
57  // the argument. By default it is zero.....
58  unsigned int _selectionIndex;
59 
60  // The dimensionality, length of the argument list:
61  unsigned int _dimensionality;
62 
63  };
64 
65 } // namespace Genfun
66 #endif