Logo ROOT   6.08/07
Reference Guide
TFormulaPrimitive.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Marian Ivanov, 2005
3 
4 /*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11 // ---------------------------------- TFormulaPrimitive.h
12 
13 #ifndef ROOT_v5_TFormulaPrimitive
14 #define ROOT_v5_TFormulaPrimitive
15 
16 
17 
18 //////////////////////////////////////////////////////////////////////////
19 // //
20 // TFormulaPrimitive //
21 // //
22 // The formula primitive base class //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #ifndef ROOT_TNamed
27 #include "TNamed.h"
28 #endif
29 #ifndef ROOT_TBits
30 #include "TBits.h"
31 #endif
32 #ifndef ROOT_TObjArray
33 #include "TObjArray.h"
34 #endif
35 
36 namespace ROOT {
37 
38  namespace v5 {
39 
40 class TFormula;
41 
42 class TFormulaPrimitive : public TNamed
43 {
44  friend class ROOT::v5::TFormula;
45 public:
46  typedef Double_t (*GenFuncG)(const Double_t*,const Double_t*);
47  typedef Double_t (*GenFunc0)();
51  typedef Double_t (TObject::*TFuncG)(const Double_t*,const Double_t*) const;
52  typedef Double_t (TObject::*TFunc0)() const;
53  typedef Double_t (TObject::*TFunc10)(Double_t) const;
56 protected:
57  static TObjArray * fgListOfFunction; //!list of global primitive formulas
58  static Int_t BuildBasicFormulas(); //build list of basic formulas
59  union {
60  GenFuncG fFuncG; //!pointer to the TFormula generic function
61  GenFunc0 fFunc0; //!pointer to the function
62  GenFunc10 fFunc10; //!pointer to the function
63  GenFunc110 fFunc110; //!pointer to the function
64  GenFunc1110 fFunc1110; //!pointer to the function
65  TFuncG fTFuncG; //!pointer to the TFormula generic function
66  TFunc0 fTFunc0; //! pointer to member function
67  TFunc10 fTFunc10; //! pointer to member function
68  TFunc110 fTFunc110; //! pointer to member function
69  TFunc1110 fTFunc1110; //! pointer to member function
70  };
71  Int_t fType; //type of the function
72  Int_t fNArguments; //number of arguments
73  Int_t fNParameters; //number of parameters
74  Bool_t fIsStatic; // indication if the function is static
75 private:
76  TFormulaPrimitive(const TFormulaPrimitive&); // Not implemented
77  TFormulaPrimitive& operator=(const TFormulaPrimitive&); // Not implemented
78 public:
80  TFormulaPrimitive(const char *name,const char *formula, GenFunc0 fpointer);
81  TFormulaPrimitive(const char *name,const char *formula, GenFunc10 fpointer);
82  TFormulaPrimitive(const char *name,const char *formula, GenFunc110 fpointer);
83  TFormulaPrimitive(const char *name,const char *formula, GenFunc1110 fpointer);
84  TFormulaPrimitive(const char *name,const char *formula, GenFuncG fpointer,Int_t npar);
85  TFormulaPrimitive(const char *name,const char *formula, TFunc0 fpointer);
86  TFormulaPrimitive(const char *name,const char *formula, TFunc10 fpointer);
87  TFormulaPrimitive(const char *name,const char *formula, TFunc110 fpointer);
88  TFormulaPrimitive(const char *name,const char *formula, TFunc1110 fpointer);
89  TFormulaPrimitive(const char *name,const char *formula, TFuncG fpointer);
90  static Int_t AddFormula(TFormulaPrimitive * formula);
91  static TFormulaPrimitive* FindFormula(const char* name);
92  static TFormulaPrimitive* FindFormula(const char* name, const char *args);
93  static TFormulaPrimitive* FindFormula(const char* name, UInt_t nargs);
94  Double_t Eval(Double_t* x); //eval primitive function
95  Double_t Eval(TObject *o, Double_t *x); //eval member function
96  Double_t Eval(Double_t *x, Double_t *param); //eval primitive parametric function
97 
98  ClassDef(ROOT::v5::TFormulaPrimitive,0) //The primitive formula
99 };
100 
101  } // end namespace v5
102 
103 } // end namespace ROOT
104 
105 
106 #endif
An array of TObjects.
Definition: TObjArray.h:39
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
Double_t(TObject::* TFunc110)(Double_t, Double_t) const
GenFunc10 fFunc10
pointer to the function
Double_t(* GenFuncG)(const Double_t *, const Double_t *)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TFunc110 fTFunc110
pointer to member function
Double_t(* GenFunc1110)(Double_t, Double_t, Double_t)
Double_t(TObject::* TFunc0)() const
TFunc0 fTFunc0
pointer to the TFormula generic function
TFormulaPrimitive & operator=(const TFormulaPrimitive &)
GenFunc0 fFunc0
pointer to the TFormula generic function
The Formula Primitive class.
TFunc10 fTFunc10
pointer to member function
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
TFunc1110 fTFunc1110
pointer to member function
Double_t(* GenFunc110)(Double_t, Double_t)
Double_t Eval(Double_t *x)
Eval primitive function at point x.
Double_t(TObject::* TFunc10)(Double_t) const
The F O R M U L A class.
Definition: TFormula.h:89
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t(* GenFunc10)(Double_t)
double Double_t
Definition: RtypesCore.h:55
The FORMULA class (ROOT version 5)
Definition: TFormula.h:71
Double_t(TObject::* TFunc1110)(Double_t, Double_t, Double_t) const
static Int_t AddFormula(TFormulaPrimitive *formula)
Add formula to the list of primitive formulas.
static Int_t BuildBasicFormulas()
list of global primitive formulas
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t(TObject::* TFuncG)(const Double_t *, const Double_t *) const
TFormulaPrimitive()
Default constructor.
GenFunc110 fFunc110
pointer to the function
static TObjArray * fgListOfFunction
char name[80]
Definition: TGX11.cxx:109
static TFormulaPrimitive * FindFormula(const char *name)
Find the formula in the list of formulas.
TFuncG fTFuncG
pointer to the function
GenFunc1110 fFunc1110
pointer to the function