Generic meta-information for n-tuple (can be used out of Darwin).
Generic class to read the meta-information contained in a list. The original goal is to read and write information to store in the list TTree::GetUserInfo()
, but it can be used in general.
The elements of the list may simply be reached with UserInfo::Get()
and written with UserInfo::Set()
. The list may contain simple types such as arithmetic types or literals as well as other lists. To reach a list, the Get
and Set
function simply need the list of keys to navigate through the tree structure, provided with additional arguments. Examples:
ui.Set<bool>("one", "two", "myBool", true);
cout << ui.Get<bool>("one", "two", "myBool") << endl;
cout << ui.Get<string>("this", "will", "fail") << endl;
The whole information may be extracted in JSON, INFO, or XML format with Darwin::Tools::UserInfo::Write()
.
This class is as generic as can be. In certain cases, one may want to use inherit from this class to enforce a more rigid structure. One example is Darwin::Tools::MetaInfo
.
|
template<typename... Args> |
TList * | List (const char *key, Args... args) const |
|
TList * | List () const |
|
template<class T , typename... Args> |
T | Get (const char *key, Args... args) const |
|
template<typename... Args> |
bool | Find (const char *key, Args... args) const |
|
template<class T , typename... Args> |
void | Set (const char *key, Args... args) const |
|
| UserInfo (const char *="UserInfo") |
|
| UserInfo (const boost::property_tree::ptree &) |
|
| UserInfo (TList *) |
|
| UserInfo (TTree *) |
|
| UserInfo (TTree *, const boost::property_tree::ptree &) |
|
| ~UserInfo () |
|
void | Write () const |
|
bool | Empty () const |
|
boost::property_tree::ptree | Write (std::ostream &, Format=INFO) const |
|
boost::property_tree::ptree | Write (const std::filesystem::path &) const |
|
boost::property_tree::ptree | MkPtree (Format format=INFO) const |
|
void | ls () const |
|
|
TList * | List (TList *mother, const char *key) const |
|
template<class T > |
T | Get (TList *mother, const char *key) const |
|
template<class T , typename... Args> |
T | Get (TList *mother, const char *key, Args... args) const |
|
bool | Find (TList *mother, const char *key) const |
|
template<typename... Args> |
bool | Find (TList *mother, const char *key, Args... args) const |
|
template<class T > |
void | Set (TList *mother, const char *key, T value) const |
|
template<class T , typename... Args> |
void | Set (TList *mother, const char *key, Args... args) const |
|
template<typename... Args> |
TList * | List (TList *mother, const char *key, Args... args) const |
|
template<class T > |
T | Get (TList *mother, std::string key) const |
|
bool | Find (TList *mother, std::string key) const |
|
TList * | List (TList *mother, std::string key) const |
|
void | ConvertPtree (const boost::property_tree::ptree &, const std::string &, TList *) |
|