RooCmdConfig.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooCmdConfig.h,v 1.12 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 #ifndef ROO_CMD_CONFIG
00018 #define ROO_CMD_CONFIG
00019 
00020 #include "TObject.h"
00021 #include "TString.h"
00022 #include "TList.h"
00023 #include "RooCmdArg.h"
00024 #include "RooArgSet.h"
00025 
00026 
00027 class RooCmdConfig : public TObject {
00028 public:
00029 
00030   RooCmdConfig(const char* methodName);
00031   RooCmdConfig(const RooCmdConfig& other) ;
00032   ~RooCmdConfig();
00033 
00034   void setVerbose(Bool_t flag) { 
00035     // If flag is true verbose messaging is activated
00036     _verbose = flag ; 
00037   }
00038 
00039   void allowUndefined(Bool_t flag=kTRUE) { 
00040     // If flag is true the processing of unrecognized RooCmdArgs
00041     // is not considered an error
00042     _allowUndefined = flag ; 
00043   }
00044   void defineDependency(const char* refArgName, const char* neededArgName) ;
00045   void defineMutex(const char* argName1, const char* argName2) ;
00046   void defineMutex(const char* argName1, const char* argName2, const char* argName3) ;
00047   void defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4) ;
00048   void defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4, const char* argName5) ;
00049   void defineRequiredArgs(const char* argName1, const char* argName2=0,
00050                           const char* argName3=0, const char* argName4=0,
00051                           const char* argName5=0, const char* argName6=0,
00052                           const char* argName7=0, const char* argName8=0) ;
00053 
00054   Bool_t defineInt(const char* name, const char* argName, Int_t intNum, Int_t defValue=0) ;
00055   Bool_t defineDouble(const char* name, const char* argName, Int_t doubleNum, Double_t defValue=0.) ;
00056   Bool_t defineString(const char* name, const char* argName, Int_t stringNum, const char* defValue="",Bool_t appendMode=kFALSE) ;
00057   Bool_t defineObject(const char* name, const char* argName, Int_t setNum, const TObject* obj=0, Bool_t isArray=kFALSE) ;
00058   Bool_t defineSet(const char* name, const char* argName, Int_t setNum, const RooArgSet* set=0) ;
00059 
00060   Bool_t process(const RooCmdArg& arg) ;
00061   Bool_t process(const RooCmdArg& arg1, const RooCmdArg& arg2, 
00062                  const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), 
00063                  const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(), 
00064                  const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
00065   Bool_t process(const RooLinkedList& argList) ;
00066 
00067   Int_t getInt(const char* name, Int_t defaultValue=0) ;
00068   Double_t getDouble(const char* name, Double_t defaultValue=0) ;
00069   const char* getString(const char* name, const char* defaultValue="",Bool_t convEmptyToNull=kFALSE) ;
00070   TObject* getObject(const char* name, TObject* obj=0) ;
00071   RooArgSet* getSet(const char* name, RooArgSet* set=0) ;
00072   const RooLinkedList& getObjectList(const char* name) ;
00073 
00074   Bool_t ok(Bool_t verbose) const ;
00075 
00076   const char* missingArgs() const ;
00077 
00078   RooLinkedList filterCmdList(RooLinkedList& cmdInList, const char* cmdNameList, Bool_t removeFromInList=kTRUE) ;
00079   void stripCmdList(RooLinkedList& cmdList, const char* cmdsToPurge) ;
00080   Bool_t hasProcessed(const char* cmdName) const ;
00081 
00082   void print() ;
00083 
00084 
00085   static Int_t decodeIntOnTheFly(const char* callerID, const char* cmdArgName, Int_t intIdx, Int_t defVal, const RooCmdArg& arg1, 
00086                                  const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
00087                                  const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
00088                                  const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
00089 
00090   static const char* decodeStringOnTheFly(const char* callerID, const char* cmdArgName, Int_t intIdx, const char* defVal, const RooCmdArg& arg1, 
00091                                          const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
00092                                          const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
00093                                          const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
00094 
00095   static TObject* decodeObjOnTheFly(const char* callerID, const char* cmdArgName, Int_t objIdx, TObject* defVal, const RooCmdArg& arg1, 
00096                                      const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
00097                                      const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
00098                                      const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
00099 
00100 protected:
00101 
00102   TString _name ;
00103   
00104   Bool_t _verbose ;
00105   Bool_t _error ;
00106   Bool_t _allowUndefined ;
00107 
00108   TList _iList ; // Integer list
00109   TList _dList ; // Double list
00110   TList _sList ; // String list
00111   TList _oList ; // Object list
00112   TList _cList ; // RooArgSet list
00113 
00114   TList _rList ; // Required cmd list
00115   TList _fList ; // Forbidden cmd list
00116   TList _mList ; // Mutex cmd list 
00117   TList _yList ; // Dependency cmd list
00118   TList _pList ; // Processed cmd list 
00119 
00120   TIterator* _iIter ; // Iterator over integer list
00121   TIterator* _dIter ; // Iterator over double list
00122   TIterator* _sIter ; // Iterator over string list
00123   TIterator* _oIter ; // Iterator over object list
00124   TIterator* _cIter ; // Iterator over RooArgSet list
00125   TIterator* _rIter ; // Iterator over required cmd list
00126   TIterator* _fIter ; // Iterator over forbidden cmd list
00127   TIterator* _mIter ; // Iterator over mutex list
00128   TIterator* _yIter ; // Iterator over dependency list
00129   TIterator* _pIter ; // Iterator over processed cmd list
00130 
00131   ClassDef(RooCmdConfig,0) // Configurable parse of RooCmdArg objects
00132 };
00133 
00134 #endif
00135 
00136 

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