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