TFormulaPrimitive.h

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TFormulaPrimitive.h 34902 2010-08-20 16:32:23Z pcanal $
00002 // Author: Marian Ivanov, 2005
00003 
00004 /*************************************************************************
00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006 * All rights reserved.                                                  *
00007 *                                                                       *
00008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010 *************************************************************************/
00011 // ---------------------------------- TFormulaPrimitive.h
00012 
00013 #ifndef ROOT_TFormulaPrimitive
00014 #define ROOT_TFormulaPrimitive
00015 
00016 
00017 
00018 //////////////////////////////////////////////////////////////////////////
00019 //                                                                      //
00020 // TFormulaPrimitive                                                    //
00021 //                                                                      //
00022 // The formula primitive base class                                     //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TNamed
00027 #include "TNamed.h"
00028 #endif
00029 #ifndef ROOT_TBits
00030 #include "TBits.h"
00031 #endif
00032 #ifndef ROOT_TObjArray
00033 #include "TObjArray.h"
00034 #endif
00035 
00036 class TFormula;
00037 
00038 class TFormulaPrimitive : public TNamed
00039 {
00040    friend class TFormula;
00041 public:
00042    typedef Double_t (*GenFuncG)(const Double_t*,const Double_t*);
00043    typedef Double_t (*GenFunc0)();
00044    typedef Double_t (*GenFunc10)(Double_t);
00045    typedef Double_t (*GenFunc110)(Double_t,Double_t);
00046    typedef Double_t (*GenFunc1110)(Double_t,Double_t, Double_t);
00047    typedef Double_t (TObject::*TFuncG)(const Double_t*,const Double_t*) const;
00048    typedef Double_t (TObject::*TFunc0)() const;
00049    typedef Double_t (TObject::*TFunc10)(Double_t) const;
00050    typedef Double_t (TObject::*TFunc110)(Double_t,Double_t) const;
00051    typedef Double_t (TObject::*TFunc1110)(Double_t,Double_t,Double_t) const;
00052 protected:
00053    static TObjArray * fgListOfFunction;                   //!list of global primitive formulas 
00054    static Int_t       BuildBasicFormulas();               //build list of basic formulas
00055    union {
00056       GenFuncG    fFuncG;                                 //!pointer to the TFormula generic function
00057       GenFunc0    fFunc0;                                 //!pointer to the function
00058       GenFunc10   fFunc10;                                //!pointer to the function
00059       GenFunc110  fFunc110;                               //!pointer to the function
00060       GenFunc1110 fFunc1110;                              //!pointer to the function
00061       TFuncG      fTFuncG;                                //!pointer to the TFormula generic function
00062       TFunc0      fTFunc0;                                //! pointer to member function
00063       TFunc10     fTFunc10;                               //! pointer to member function
00064       TFunc110    fTFunc110;                              //! pointer to member function
00065       TFunc1110   fTFunc1110;                             //! pointer to member function
00066    };
00067    Int_t      fType;                                      //type of the function  
00068    Int_t      fNArguments;                                //number of arguments
00069    Int_t      fNParameters;                               //number of parameters
00070    Bool_t     fIsStatic;                                  // indication if the function is static
00071 private:
00072    TFormulaPrimitive(const TFormulaPrimitive&); // Not implemented
00073    TFormulaPrimitive& operator=(const TFormulaPrimitive&); // Not implemented
00074 public:
00075    TFormulaPrimitive();
00076    TFormulaPrimitive(const char *name,const char *formula, GenFunc0 fpointer);
00077    TFormulaPrimitive(const char *name,const char *formula, GenFunc10 fpointer);
00078    TFormulaPrimitive(const char *name,const char *formula, GenFunc110 fpointer); 
00079    TFormulaPrimitive(const char *name,const char *formula, GenFunc1110 fpointer);
00080    TFormulaPrimitive(const char *name,const char *formula, GenFuncG fpointer,Int_t npar);  
00081    TFormulaPrimitive(const char *name,const char *formula, TFunc0 fpointer);  
00082    TFormulaPrimitive(const char *name,const char *formula, TFunc10 fpointer);  
00083    TFormulaPrimitive(const char *name,const char *formula, TFunc110 fpointer);  
00084    TFormulaPrimitive(const char *name,const char *formula, TFunc1110 fpointer);  
00085    TFormulaPrimitive(const char *name,const char *formula, TFuncG fpointer);  
00086    static Int_t AddFormula(TFormulaPrimitive * formula);
00087    static TFormulaPrimitive* FindFormula(const char* name);
00088    static TFormulaPrimitive* FindFormula(const char* name, const char *args);
00089    static TFormulaPrimitive* FindFormula(const char* name, UInt_t nargs);
00090    Double_t Eval(Double_t* x);                   //eval primitive function
00091    Double_t Eval(TObject *o,  Double_t *x);      //eval member function
00092    Double_t Eval(Double_t *x, Double_t *param);  //eval primitive parametric function
00093 
00094    ClassDef(TFormulaPrimitive,0)  //The primitive formula 
00095 };
00096 
00097 #endif

Generated on Tue Jul 5 14:22:49 2011 for ROOT_528-00b_version by  doxygen 1.5.1