|
18 | 18 | #include <boost/property_tree/ptree.hpp> |
19 | 19 | #include <typeinfo> |
20 | 20 |
|
| 21 | +class TFile; |
| 22 | +class TRootIOCtor; |
| 23 | + |
21 | 24 | namespace o2 |
22 | 25 | { |
23 | 26 | namespace conf |
@@ -77,7 +80,7 @@ class ConfigurableParam |
77 | 80 | { |
78 | 81 | public: |
79 | 82 | // |
80 | | - virtual std::string getName() = 0; // print the name of the configurable Parameter |
| 83 | + virtual std::string getName() const = 0; // print the name of the configurable Parameter |
81 | 84 |
|
82 | 85 | // print the current keys and values to screen |
83 | 86 | virtual void printKeyValues() = 0; |
@@ -120,6 +123,11 @@ class ConfigurableParam |
120 | 123 |
|
121 | 124 | static void initialize(); |
122 | 125 |
|
| 126 | + static void toCCDB(std::string filename); |
| 127 | + static void fromCCDB(std::string filename); |
| 128 | + virtual void serializeTo(TFile*) const = 0; |
| 129 | + virtual void initFrom(TFile*) = 0; |
| 130 | + |
123 | 131 | // allows to provide a file from which to update |
124 | 132 | // (certain) key-values |
125 | 133 | // propagates changes down to each registered configuration |
@@ -149,19 +157,24 @@ class ConfigurableParam |
149 | 157 | // (internal use to easily sync updates, this is ok since parameter classes are singletons) |
150 | 158 | static std::map<std::string, std::pair<int, void*>>* sKeyToStorageMap; |
151 | 159 |
|
| 160 | + void setRegisterMode(bool b) { sRegisterMode = b; } |
| 161 | + |
152 | 162 | private: |
153 | 163 | // static registry for implementations of this type |
154 | 164 | static std::vector<ConfigurableParam*>* sRegisteredParamClasses; //! |
155 | 165 | // static property tree (stocking all key - value pairs from instances of type ConfigurableParam) |
156 | 166 | static boost::property_tree::ptree* sPtree; //! |
157 | 167 | static bool sIsFullyInitialized; //! |
| 168 | + static bool sRegisterMode; //! (flag to enable/disable autoregistering of child classes) |
158 | 169 | }; |
159 | 170 |
|
160 | 171 | } // end namespace conf |
161 | 172 | } // end namespace o2 |
162 | 173 |
|
163 | 174 | // a helper macro for boilerplate code in parameter classes |
164 | 175 | #define O2ParamDef(classname, key) \ |
| 176 | + public: \ |
| 177 | + classname(TRootIOCtor *) {} \ |
165 | 178 | private: \ |
166 | 179 | static constexpr char const* const sKey = key; \ |
167 | 180 | static classname sInstance; \ |
|
0 commit comments