14#ifndef COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
15#define COMMON_SIMCONFIG_INCLUDE_SIMCONFIG_CONFIGURABLEPARAMHELPER_H_
38 std::string
toString(std::string
const& prefix,
bool showProv,
size_t padding = 0)
const;
48 static std::vector<ParamDataMember>* getDataMembersImpl(std::string
const& mainkey, TClass* cl,
void*,
49 std::map<std::string, ConfigurableParam::EParamProvenance>
const* provmap,
size_t virtualoffset);
51 static void fillKeyValuesImpl(std::string
const& mainkey, TClass* cl,
void*, boost::property_tree::ptree*,
52 std::map<std::string, std::pair<std::type_info const&, void*>>*,
55 static void printWarning(std::type_info
const&);
57 static void assignmentImpl(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
58 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
59 static void syncCCDBandRegistry(std::string
const& mainkey, TClass* cl,
void* to,
void* from,
60 std::map<std::string, ConfigurableParam::EParamProvenance>* provmap,
size_t offset);
62 static void outputMembersImpl(std::ostream& out, std::string
const& mainkey, std::vector<ParamDataMember>
const*
members,
bool showProv,
bool useLogger,
bool withPadding =
false,
bool showHash =
false);
63 static void printMembersImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const*
members,
bool showProv,
bool useLogger,
bool withPadding,
bool showHash);
65 static size_t getHashImpl(std::string
const& mainkey, std::vector<ParamDataMember>
const*
members);
70 template <
typename Base,
typename P>
104 void printKeyValues(
bool showProv =
true,
bool useLogger =
false,
bool withPadding =
true,
bool showHash =
true) const final
110 _ParamHelper::printMembersImpl(
getName(),
members.get(), showProv, useLogger, withPadding, showHash);
122 void output(std::ostream& out)
const final
125 _ParamHelper::outputMembersImpl(out,
getName(),
members.get(),
true,
false);
138 static_assert(std::is_same<
decltype(P::sInstance),
P>
::value,
139 "static instance must of same type as class");
142 auto cl = TClass::GetClass(
typeid(
P));
144 _ParamHelper::printWarning(
typeid(
P));
156 auto cl = TClass::GetClass(
typeid(
P));
158 _ParamHelper::printWarning(
typeid(
P));
171 P* readback =
nullptr;
172 file->GetObject(
getName().c_str(), readback);
173 if (readback !=
nullptr) {
174 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(
P)), (
void*)
this, (
void*)readback,
192 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(
P)), (
void*)
this, (
void*)externalobj,
201 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(
P)),
getName().c_str());
208template <
typename P,
typename Base>
222 static_assert(std::copyable<Base>,
"Base type must be copyable.");
223 return static_cast<Base>(*this);
242 void printKeyValues(
bool showProv =
true,
bool useLogger =
false,
bool withPadding =
true,
bool showHash =
true) const final
248 _ParamHelper::printMembersImpl(
getName(),
members.get(), showProv, useLogger, withPadding, showHash);
260 void output(std::ostream& out)
const final
263 _ParamHelper::outputMembersImpl(out,
getName(),
members.get(),
true,
false);
276 static_assert(std::is_same<
decltype(P::sInstance),
P>
::value,
277 "static instance must of same type as class");
280 auto cl = TClass::GetClass(
typeid(
Base));
282 _ParamHelper::printWarning(
typeid(
Base));
296 auto cl = TClass::GetClass(
typeid(
Base));
298 _ParamHelper::printWarning(
typeid(
Base));
311 P* readback =
nullptr;
312 file->GetObject(
getName().c_str(), readback);
313 if (readback !=
nullptr) {
314 _ParamHelper::assignmentImpl(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)readback,
332 _ParamHelper::syncCCDBandRegistry(
getName(), TClass::GetClass(
typeid(
Base)), (
void*)
this, (
void*)externalobj,
341 file->WriteObjectAny((
void*)
this, TClass::GetClass(
typeid(
P)),
getName().c_str());
bounded_vector< int > members
EParamProvenance getMemberProvenance(const std::string &key) const final
void printKeyValues(bool showProv=true, bool useLogger=false, bool withPadding=true, bool showHash=true) 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, size_t padding=0) const
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))