Configuration Options

These classes define configuration options and methods to parse configuration files. Defined in src/utils/ConfigParser.h and src/utils/Option.h

class ConfigParser : public TObject

Public Functions

int Parse(std::string filename = "")

Read the config file, parse and set info to be used by other classes.

inline void PrintOptions()

Print registered options.

template<typename T>
inline std::shared_ptr<Option<T>> GetOption(std::string name)

Register options.

inline bool HasOption(std::string name)

Check registered options.

inline int SetOptionFromString(std::string name, std::string stringified_value)

Set option from string.

template<typename T>
inline int GetOptionValue(std::string name, T &value)

Get option value.

inline TTree *GetConfigTree(std::string treeName = "CfgInfo")

Get config option tree.

template<typename T>
class Option : public Caesar::OptionBase

Public Functions

inline Option()

Default Class constructor (needed by ROOT IO)

inline Option(std::string name, T defaultValue, T minValue, T maxValue)

Class constructor.

inline virtual ~Option()

Class destructor.

inline virtual int SetValueFromStream(std::stringstream &sstream)

Set option value from stringstream.

inline virtual int SetValueFromString(std::string const &s)

Set option value from string.

inline int SetValue(T value)

Set option value.

inline T GetValue()

Get option value.

inline T GetDefaultValue()

Get default value.

inline virtual int GetJson(Json::Value &jsonObj)

Get json object from option.

inline virtual int GetJsonString(std::string &jsonString, bool isMinified = true)

Get json string.

inline bool CheckRange(T &value)

Check given value against registered range (non sense for bool, string/char)?

inline virtual void Print()

Print option.

inline virtual int AddBranch(TTree *tree)

Add a TBranch to input TTree.