Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooCmdConfig.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooCmdConfig.h,v 1.12 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
17 #ifndef ROO_CMD_CONFIG
18 #define ROO_CMD_CONFIG
19 
20 #include "TObject.h"
21 #include "TString.h"
22 #include "TList.h"
23 #include "RooCmdArg.h"
24 #include "RooArgSet.h"
25 
26 
27 class RooCmdConfig : public TObject {
28 public:
29 
30  RooCmdConfig(const char* methodName);
31  RooCmdConfig(const RooCmdConfig& other) ;
32  ~RooCmdConfig();
33 
34  void setVerbose(Bool_t flag) {
35  // If flag is true verbose messaging is activated
36  _verbose = flag ;
37  }
38 
39  void allowUndefined(Bool_t flag=kTRUE) {
40  // If flag is true the processing of unrecognized RooCmdArgs
41  // is not considered an error
42  _allowUndefined = flag ;
43  }
44  void defineDependency(const char* refArgName, const char* neededArgName) ;
45  void defineMutex(const char* argName1, const char* argName2) ;
46  void defineMutex(const char* argName1, const char* argName2, const char* argName3) ;
47  void defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4) ;
48  void defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4, const char* argName5) ;
49  void defineRequiredArgs(const char* argName1, const char* argName2=0,
50  const char* argName3=0, const char* argName4=0,
51  const char* argName5=0, const char* argName6=0,
52  const char* argName7=0, const char* argName8=0) ;
53 
54  Bool_t defineInt(const char* name, const char* argName, Int_t intNum, Int_t defValue=0) ;
55  Bool_t defineDouble(const char* name, const char* argName, Int_t doubleNum, Double_t defValue=0.) ;
56  Bool_t defineString(const char* name, const char* argName, Int_t stringNum, const char* defValue="",Bool_t appendMode=kFALSE) ;
57  Bool_t defineObject(const char* name, const char* argName, Int_t setNum, const TObject* obj=0, Bool_t isArray=kFALSE) ;
58  Bool_t defineSet(const char* name, const char* argName, Int_t setNum, const RooArgSet* set=0) ;
59 
60  Bool_t process(const RooCmdArg& arg) ;
61  Bool_t process(const RooCmdArg& arg1, const RooCmdArg& arg2,
62  const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
63  const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
64  const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
65  Bool_t process(const RooLinkedList& argList) ;
66 
67  Int_t getInt(const char* name, Int_t defaultValue=0) ;
68  Double_t getDouble(const char* name, Double_t defaultValue=0) ;
69  const char* getString(const char* name, const char* defaultValue="",Bool_t convEmptyToNull=kFALSE) ;
70  TObject* getObject(const char* name, TObject* obj=0) ;
71  RooArgSet* getSet(const char* name, RooArgSet* set=0) ;
72  const RooLinkedList& getObjectList(const char* name) ;
73 
74  Bool_t ok(Bool_t verbose) const ;
75 
76  const char* missingArgs() const ;
77 
78  RooLinkedList filterCmdList(RooLinkedList& cmdInList, const char* cmdNameList, Bool_t removeFromInList=kTRUE) ;
79  void stripCmdList(RooLinkedList& cmdList, const char* cmdsToPurge) ;
80  Bool_t hasProcessed(const char* cmdName) const ;
81 
82  void print() ;
83 
84 
85  static Int_t decodeIntOnTheFly(const char* callerID, const char* cmdArgName, Int_t intIdx, Int_t defVal, const RooCmdArg& arg1,
86  const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
87  const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
88  const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
89 
90  static std::string decodeStringOnTheFly(const char* callerID, const char* cmdArgName, Int_t intIdx, const char* defVal, const RooCmdArg& arg1,
91  const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
92  const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
93  const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
94 
95  static TObject* decodeObjOnTheFly(const char* callerID, const char* cmdArgName, Int_t objIdx, TObject* defVal, const RooCmdArg& arg1,
96  const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
97  const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(), const RooCmdArg& arg7=RooCmdArg(),
98  const RooCmdArg& arg8=RooCmdArg(), const RooCmdArg& arg9=RooCmdArg()) ;
99 
100 protected:
101 
102  TString _name ;
103 
104  Bool_t _verbose ;
105  Bool_t _error ;
106  Bool_t _allowUndefined ;
107 
108  TList _iList ; // Integer list
109  TList _dList ; // Double list
110  TList _sList ; // String list
111  TList _oList ; // Object list
112  TList _cList ; // RooArgSet list
113 
114  TList _rList ; // Required cmd list
115  TList _fList ; // Forbidden cmd list
116  TList _mList ; // Mutex cmd list
117  TList _yList ; // Dependency cmd list
118  TList _pList ; // Processed cmd list
119 
120  TIterator* _iIter ; // Iterator over integer list
121  TIterator* _dIter ; // Iterator over double list
122  TIterator* _sIter ; // Iterator over string list
123  TIterator* _oIter ; // Iterator over object list
124  TIterator* _cIter ; // Iterator over RooArgSet list
125  TIterator* _rIter ; // Iterator over required cmd list
126  TIterator* _fIter ; // Iterator over forbidden cmd list
127  TIterator* _mIter ; // Iterator over mutex list
128  TIterator* _yIter ; // Iterator over dependency list
129  TIterator* _pIter ; // Iterator over processed cmd list
130 
131  ClassDef(RooCmdConfig,0) // Configurable parse of RooCmdArg objects
132 };
133 
134 #endif
135 
136