1 | #ifndef ExRootConfReader_h
|
---|
2 | #define ExRootConfReader_h
|
---|
3 |
|
---|
4 | /** \class ExRootConfReader
|
---|
5 | *
|
---|
6 | * Class handling output ROOT tree
|
---|
7 | *
|
---|
8 | * $Date: 2008-06-04 13:57:24 $
|
---|
9 | * $Revision: 1.1 $
|
---|
10 | *
|
---|
11 | *
|
---|
12 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
13 | *
|
---|
14 | */
|
---|
15 |
|
---|
16 | #include "TNamed.h"
|
---|
17 |
|
---|
18 | #include <map>
|
---|
19 | #include <utility>
|
---|
20 |
|
---|
21 | struct Tcl_Obj;
|
---|
22 | struct Tcl_Interp;
|
---|
23 |
|
---|
24 | class ExRootConfParam
|
---|
25 | {
|
---|
26 | public:
|
---|
27 |
|
---|
28 | ExRootConfParam(const char *name = 0, Tcl_Obj *object = 0, Tcl_Interp *interp = 0);
|
---|
29 |
|
---|
30 | int GetInt(int defaultValue = 0);
|
---|
31 | long GetLong(long defaultValue = 0);
|
---|
32 | double GetDouble(double defaultValue = 0.0);
|
---|
33 | bool GetBool(bool defaultValue = false);
|
---|
34 | const char *GetString(const char *defaultValue = "");
|
---|
35 |
|
---|
36 | int GetSize();
|
---|
37 | ExRootConfParam operator[](int index);
|
---|
38 |
|
---|
39 | private:
|
---|
40 |
|
---|
41 | const char *fName;
|
---|
42 | Tcl_Obj *fObject;
|
---|
43 | Tcl_Interp *fTclInterp;
|
---|
44 | };
|
---|
45 |
|
---|
46 | //------------------------------------------------------------------------------
|
---|
47 |
|
---|
48 | class ExRootConfReader : public TNamed
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | typedef std::map<TString, TString> ExRootTaskMap;
|
---|
52 |
|
---|
53 | ExRootConfReader();
|
---|
54 | ~ExRootConfReader();
|
---|
55 |
|
---|
56 | void ReadFile(const char *fileName);
|
---|
57 |
|
---|
58 | int GetInt(const char *name, int defaultValue, int index = -1);
|
---|
59 | long GetLong(const char *name, long defaultValue, int index = -1);
|
---|
60 | double GetDouble(const char *name, double defaultValue, int index = -1);
|
---|
61 | bool GetBool(const char *name, bool defaultValue, int index = -1);
|
---|
62 | const char *GetString(const char *name, const char *defaultValue, int index = -1);
|
---|
63 | ExRootConfParam GetParam(const char *name);
|
---|
64 |
|
---|
65 | const ExRootTaskMap *GetModules() const { return &fModules; }
|
---|
66 |
|
---|
67 | void AddModule(const char *className, const char *moduleName);
|
---|
68 |
|
---|
69 | private:
|
---|
70 |
|
---|
71 | Tcl_Interp *fTclInterp;
|
---|
72 |
|
---|
73 | ExRootTaskMap fModules;
|
---|
74 |
|
---|
75 | ClassDef(ExRootConfReader, 1)
|
---|
76 | };
|
---|
77 |
|
---|
78 | #endif
|
---|
79 |
|
---|