|
18 | 18 | #include "Framework/ProcessingContext.h" |
19 | 19 | #include "Framework/EndOfStreamContext.h" |
20 | 20 | #include "Framework/HistogramRegistry.h" |
| 21 | +#include "Framework/CCDBParamSpec.h" |
21 | 22 | #include "Framework/ConfigParamSpec.h" |
22 | 23 | #include "Framework/ConfigParamRegistry.h" |
23 | 24 | #include "Framework/ConfigurableHelpers.h" |
| 25 | +#include "Framework/Condition.h" |
24 | 26 | #include "Framework/InitContext.h" |
25 | 27 | #include "Framework/ConfigContext.h" |
26 | 28 | #include "Framework/RootConfigParamHelpers.h" |
@@ -155,6 +157,46 @@ struct FilterManager<expressions::Filter> { |
155 | 157 | } |
156 | 158 | }; |
157 | 159 |
|
| 160 | +/// A manager which takes care of condition objects |
| 161 | +template <typename T> |
| 162 | +struct ConditionManager { |
| 163 | + template <typename ANY> |
| 164 | + static bool appendCondition(std::vector<InputSpec>& inputs, ANY& x) |
| 165 | + { |
| 166 | + if constexpr (std::is_base_of_v<ConditionGroup, ANY>) { |
| 167 | + homogeneous_apply_refs<true>([&inputs](auto& y) { return ConditionManager<std::decay_t<decltype(y)>>::appendCondition(inputs, y); }, x); |
| 168 | + return true; |
| 169 | + } else { |
| 170 | + return false; |
| 171 | + } |
| 172 | + } |
| 173 | + |
| 174 | + template <typename ANY> |
| 175 | + static bool newDataframe(InputRecord& record, ANY& x) |
| 176 | + { |
| 177 | + if constexpr (std::is_base_of_v<ConfigurableGroup, ANY>) { |
| 178 | + homogeneous_apply_refs<true>([&record](auto&& y) { return ConditionManager<std::decay_t<decltype(y)>>::newDataframe(record, y); }, x); |
| 179 | + return true; |
| 180 | + } else { |
| 181 | + return false; |
| 182 | + } |
| 183 | + } |
| 184 | +}; |
| 185 | + |
| 186 | +template <typename OBJ> |
| 187 | +struct ConditionManager<Condition<OBJ>> { |
| 188 | + static bool appendCondition(std::vector<InputSpec>& inputs, Condition<OBJ>& what) |
| 189 | + { |
| 190 | + inputs.emplace_back(InputSpec{what.path, "AODC", compile_time_hash(what.path.c_str()), Lifetime::Condition, ccdbParamSpec(what.path)}); |
| 191 | + return true; |
| 192 | + } |
| 193 | + static bool newDataframe(InputRecord& inputs, Condition<OBJ>& what) |
| 194 | + { |
| 195 | + what.instance(inputs.get<OBJ>(what.path)); |
| 196 | + return true; |
| 197 | + } |
| 198 | +}; |
| 199 | + |
158 | 200 | /// SFINAE placeholder |
159 | 201 | template <typename T> |
160 | 202 | struct OutputManager { |
|
0 commit comments