DAS
3.0
Das Analysis System
|
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:
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
.
#include <UserInfo.h>
Public Types | |
enum | Format { INFO, JSON, XML, INFO, JSON, XML } |
enum | Format { INFO, JSON, XML, INFO, JSON, XML } |
Public Member Functions | |
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 |
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 |
Protected Member Functions | |
boost::property_tree::ptree | MkPtree (TList *, Format=INFO) const |
boost::property_tree::ptree | MkPtree (TList *, Format=INFO) const |
Private Member Functions | |
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 *) |
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 *) |
Private Attributes | |
bool | own |
TList * | l |
enum Format |
Supported serialization formats.
enum Format |
Supported serialization formats.
UserInfo | ( | const char * | name = "UserInfo" | ) |
UserInfo | ( | const boost::property_tree::ptree & | ptree | ) |
UserInfo | ( | TList * | L | ) |
UserInfo | ( | TTree * | t | ) |
UserInfo | ( | TTree * | tree, |
const boost::property_tree::ptree & | ptree | ||
) |
UserInfo | ( | const char * | = "UserInfo" | ) |
Constructor (starting from scratch)
UserInfo | ( | const boost::property_tree::ptree & | ) |
Constructor (starting from existing ptree)
UserInfo | ( | TList * | ) |
Constructor (starting from existing list)
UserInfo | ( | TTree * | ) |
Constructor (starting from TTree)
UserInfo | ( | TTree * | , |
const boost::property_tree::ptree & | |||
) |
constructor (inserting existing ptree direcrly in a ttree)
~UserInfo | ( | ) |
Destructor.
|
private |
Helper function to convert a ptree to a TList Supports making strings, bools, ints, and floats.
|
private |
Helper function to convert a ptree to a TList Supports making strings, bools, ints, and floats.
bool Empty | ( | ) | const |
Check if list is empty.
bool Empty | ( | ) | const |
Check if list is empty.
|
inline |
|
inline |
|
inlineprivate |
Recursive finder.
|
inlineprivate |
Recursive finder.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
finder with string
|
inlineprivate |
finder with string
|
inline |
|
inline |
|
inlineprivate |
Final getter. The behaviour for arithmetic types and for literal (default) is slightly different, since literals don't really have a key. Literals are always contained in a list, and the last element of the list is returned.
|
inlineprivate |
Final getter. The behaviour for arithmetic types and for literal (default) is slightly different, since literals don't really have a key. Literals are always contained in a list, and the last element of the list is returned.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
value getter with string
|
inlineprivate |
value getter with string
|
inline |
Access directly to main list.
|
inline |
Access directly to main list.
|
inline |
|
inline |
|
private |
Accest do daughter list from a mother list.
|
private |
Accest do daughter list from a mother list.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
list getter with string
|
inlineprivate |
list getter with string
Write TList
to Boost Property Tree. Calls itself recursively. Internally, it uses Boost Preprocessor macros to loop over types.
TList
given in argument in Property Tree format Write TList
to Boost Property Tree. Calls itself recursively. Internally, it uses Boost Preprocessor macros to loop over types.
TList
given in argument in Property Tree format list | list to write to `ptree` |
format | format of output file (e.g. XML cannot handle empty keys) |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
(Re)sets elements of a given list.
Only arithmetic types have a key and a value. Literals only have identical key and value.
|
inlineprivate |
(Re)sets elements of a given list.
Only arithmetic types have a key and a value. Literals only have identical key and value.
void Write | ( | ) | const |
Write TList
to TFile
in ROOT format.
void Write | ( | ) | const |
pt::ptree Write | ( | const std::filesystem::path & | p | ) | const |
Write to file with Boost. Calls MkPtree
to write sublists.
TList
in Property Tree format p | path to output |
boost::property_tree::ptree Write | ( | const std::filesystem::path & | ) | const |
Write to file with Boost. Calls MkPtree
to write sublists.
TList
in Property Tree format Write to stream with Boost. Calls MkPtree
to write sublists.
TList
in Property Tree format Write to stream with Boost. Calls MkPtree
to write sublists.
TList
in Property Tree format out | output stream |
format | format of output |
|
private |
main list (typically from TTree::GetUserInfo()
)
|
private |