ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 const char* 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 
103 
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 
TIterator * _dIter
Definition: RooCmdConfig.h:121
Bool_t hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
RooCmdConfig(const char *methodName)
Constructor taking descriptive name of owner/user which is used as prefix for any warning or error me...
TIterator * _iIter
Definition: RooCmdConfig.h:120
Bool_t defineDouble(const char *name, const char *argName, Int_t doubleNum, Double_t defValue=0.)
Define Double_t property name 'name' mapped to Double_t in slot 'doubleNum' in RooCmdArg with name ar...
void setVerbose(Bool_t flag)
Definition: RooCmdConfig.h:34
static const char * decodeStringOnTheFly(const char *callerID, const char *cmdArgName, Int_t intIdx, const char *defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve string property from set of RooCmdArgs For use in base mem...
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
void defineRequiredArgs(const char *argName1, const char *argName2=0, const char *argName3=0, const char *argName4=0, const char *argName5=0, const char *argName6=0, const char *argName7=0, const char *argName8=0)
Add condition that any of listed arguments must be processed for parsing to be declared successful...
Bool_t defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=0)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
TIterator * _mIter
Definition: RooCmdConfig.h:127
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void allowUndefined(Bool_t flag=kTRUE)
Definition: RooCmdConfig.h:39
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
Iterator abstract base class.
Definition: TIterator.h:32
~RooCmdConfig()
Destructor.
TIterator * _oIter
Definition: RooCmdConfig.h:123
Bool_t _verbose
Definition: RooCmdConfig.h:104
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:50
const char * missingArgs() const
Return string with names of arguments that were required, but not processed.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name 'name' mapped to Double_t in slot 'stringNum' in RooCmdArg with name ar...
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
Bool_t defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList...
A doubly linked list.
Definition: TList.h:47
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
static TObject * decodeObjOnTheFly(const char *callerID, const char *cmdArgName, Int_t objIdx, TObject *defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve object property from set of RooCmdArgs For use in base mem...
TIterator * _pIter
Definition: RooCmdConfig.h:129
TIterator * _rIter
Definition: RooCmdConfig.h:125
bool verbose
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Definition: RooCmdConfig.h:27
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
static Int_t decodeIntOnTheFly(const char *callerID, const char *cmdArgName, Int_t intIdx, Int_t defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve integer property from set of RooCmdArgs For use in base me...
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooArgSet * getSet(const char *name, RooArgSet *set=0)
Return RooArgSet property registered with name 'name'.
double Double_t
Definition: RtypesCore.h:55
Bool_t _allowUndefined
Definition: RooCmdConfig.h:106
Double_t getDouble(const char *name, Double_t defaultValue=0)
Return Double_t property registered with name 'name'.
TIterator * _sIter
Definition: RooCmdConfig.h:122
TIterator * _fIter
Definition: RooCmdConfig.h:126
void print()
Print configuration of parser.
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
#define name(a, b)
Definition: linkTestLib0.cpp:5
TIterator * _cIter
Definition: RooCmdConfig.h:124
Mother of all ROOT objects.
Definition: TObject.h:58
Bool_t defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=0, Bool_t isArray=kFALSE)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
RooLinkedList filterCmdList(RooLinkedList &cmdInList, const char *cmdNameList, Bool_t removeFromInList=kTRUE)
Utility function to filter commands listed in cmdNameList from cmdInList.
TIterator * _yIter
Definition: RooCmdConfig.h:128
TString _name
Definition: RooCmdConfig.h:102
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27