14#ifndef COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
15#define COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
37 std::string
toString(std::string
const& prefix,
bool showProv)
const;
47 static std::vector<ParamDataMember>* getDataMembersImpl(std::string
const& mainkey, TClass* cl,
void*,
48 std::map<std::string, ConfigurableParam::EParamProvenance>
const* provmap,
size_t virtualoffset);
50 static void fillKeyValuesImpl(std::string
const& mainkey, TClass* cl,
void*, boost::property_tree::ptree*,
51 std::map<std::string, std::pair<std::type_info const&, void*>>*,
54 static void printWarning(std::type_info
const&);
56 static void assignmentImpl(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
57 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
58 static void syncCCDBandRegistry(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
59 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
61 static void outputMembersImpl(std::ostream& out, std::string
const& mainkey, std::vector<ParamDataMember>
const* members,
bool showProv,
bool useLogger);
62 static void printMembersImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const* members,
bool showProv,
bool useLogger);
64 static size_t getHashImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const* members);
69 template <
typename Base,
typename P>
109 _ParamHelper::printMembersImpl(
getName(), members, showProv, useLogger);
120 void output(std::ostream& out)
const final
123 _ParamHelper::outputMembersImpl(out,
getName(), members,
true,
false);
136 static_assert(std::is_same<
decltype(P::sInstance), P>
::value,
137 "static instance must of same type as class");
140 auto cl = TClass::GetClass(
typeid(P));
142 _ParamHelper::printWarning(
typeid(P));
154 auto cl = TClass::GetClass(
typeid(P));
156 _ParamHelper::printWarning(
typeid(P));
169 P* readback =
nullptr;
171 if (readback !=
nullptr) {
172 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(P)), (
void*)
this, (
void*)readback,
190 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(P)), (
void*)
this, (
void*)externalobj,
199 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(P)),
getName().c_str());
206template <
typename P,
typename Base>
220 static_assert(std::copyable<Base>,
"Base type must be copyable.");
221 return static_cast<Base>(*this);
246 _ParamHelper::printMembersImpl(
getName(), members, showProv, useLogger);
257 void output(std::ostream& out)
const final
260 _ParamHelper::outputMembersImpl(out,
getName(), members,
true,
false);
273 static_assert(std::is_same<
decltype(P::sInstance), P>
::value,
274 "static instance must of same type as class");
277 auto cl = TClass::GetClass(
typeid(
Base));
279 _ParamHelper::printWarning(
typeid(
Base));
293 auto cl = TClass::GetClass(
typeid(
Base));
295 _ParamHelper::printWarning(
typeid(
Base));
308 P* readback =
nullptr;
310 if (readback !=
nullptr) {
311 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)readback,
329 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)externalobj,
338 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(P)),
getName().c_str());
void printKeyValues(bool showProv=true, bool useLogger=false) const final
EParamProvenance getMemberProvenance(const std::string &key) const final
void syncCCDBandRegistry(void *externalobj) final
void serializeTo(TFile *file) const final
static const P & Instance()
void putKeyValues(boost::property_tree::ptree *tree) final
std::vector< ParamDataMember > * getDataMembers() const
void initFrom(TFile *file) final
void output(std::ostream &out) const final
size_t getHash() const final
std::string getName() const final
static std::map< std::string, std::pair< std::type_info const &, void * > > * sKeyToStorageMap
void setRegisterMode(bool b)
bool isInitialized() const
static std::map< std::string, ConfigurableParam::EParamProvenance > * sValueProvenanceMap
static EParamProvenance getProvenance(const std::string &key)
static EnumRegistry * sEnumRegistry
GLsizei const GLfloat * value
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string toString(std::string const &prefix, bool showProv) const
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))