ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
ctd::file::Yaml Class Reference

Class implementing the handling of Yaml files in the ICS environment. More...

#include <Yaml.hpp>

Inheritance diagram for ctd::file::Yaml:
ctd::file::ParameterSet ctd::file::ParameterSet ctd::file::ParameterSet

Public Member Functions

 Yaml ()
 
 ~Yaml ()
 
virtual void LoadUser (const std::string &file_name, const bool merge=false)
 Load the Yaml file and convert its contents into a dictionary. More...
 
 Yaml ()
 
 ~Yaml ()
 
virtual void LoadUser (const std::string &file_name, const bool merge=false)
 Load the Yaml file and convert its contents into a dictionary. More...
 
 Yaml ()
 
 ~Yaml ()
 
virtual void LoadUser (const std::string &file_name, const bool merge=false)
 Load the Yaml file and convert its contents into a dictionary. More...
 
- Public Member Functions inherited from ctd::file::ParameterSet
 ParameterSet ()
 
 ParameterSet (const ParameterSet &source)
 Copy constructor. More...
 
 ~ParameterSet ()
 
virtual void Load (const std::string &filename, const bool merge=false)
 Load a file containing parameters. More...
 
void Store (const std::string &par_name, const std::string &value, const std::string &comment="")
 Store a parameter name, value and possibly comment in the object. More...
 
std::string GetValueAsString (const std::string &par_name, const bool exception=false) const
 Return value for the referenced parameter as a string. More...
 
template<class TYPE >
bool GetValue (const std::string &name, TYPE &value, const bool exception=false) const
 Return value for the referenced parameter as its native data type. More...
 
const ctd::file::ParameterGetPar (const std::string &par_name) const
 Get reference to parameter object, referenced by its name. More...
 
bool HasPar (const std::string &par_name) const
 Returns true if parameter is defined. More...
 
bool HasPar (const std::string &par_name, ctd::file::Parameter &parameter) const
 Returns true if parameter defined, copies parameter object to object provided. More...
 
template<class TYPE >
bool HasPar (const std::string &par_name, TYPE &value) const
 Return trie if parameter defined, sets the value as the native value. More...
 
uint32_t Scan (const std::string &filter_reg_exp, ctd::defines::List< ctd::file::Parameter > &matches) const
 Scans through the parameter object namespace and creates list of matching parameters. More...
 
std::string Print (const std::string &filter_reg_exp="") const
 Prints out contents of object, applying regular expression filtering, if specified. More...
 
ctd::defines::List< std::string > ParNames () const
 Returns list of parameter names. More...
 
const std::map< std::string,
ctd::file::Parameter > & 
GetParameterMap () const
 Return reference to the internal map with the names/parameter objects. More...
 
const std::string & GetProcFile () const
 Return reference to file being processed (loaded). More...
 
ParameterSetoperator= (const ParameterSet &source)
 Assignment operator. More...
 
 ParameterSet ()
 
 ParameterSet (const ParameterSet &source)
 Copy constructor. More...
 
 ~ParameterSet ()
 
virtual void Load (const std::string &filename, const bool merge=false)
 Load a file containing parameters. More...
 
void Store (const std::string &par_name, const std::string &value, const std::string &comment="")
 Store a parameter name, value and possibly comment in the object. More...
 
std::string GetValueAsString (const std::string &par_name, const bool exception=false) const
 Return value for the referenced parameter as a string. More...
 
template<class TYPE >
bool GetValue (const std::string &name, TYPE &value, const bool exception=false) const
 Return value for the referenced parameter as its native data type. More...
 
const ctd::file::ParameterGetPar (const std::string &par_name) const
 Get reference to parameter object, referenced by its name. More...
 
bool HasPar (const std::string &par_name) const
 Returns true if parameter is defined. More...
 
bool HasPar (const std::string &par_name, ctd::file::Parameter &parameter) const
 Returns true if parameter defined, copies parameter object to object provided. More...
 
template<class TYPE >
bool HasPar (const std::string &par_name, TYPE &value) const
 Return trie if parameter defined, sets the value as the native value. More...
 
uint32_t Scan (const std::string &filter_reg_exp, ctd::defines::List< ctd::file::Parameter > &matches) const
 Scans through the parameter object namespace and creates list of matching parameters. More...
 
std::string Print (const std::string &filter_reg_exp="") const
 Prints out contents of object, applying regular expression filtering, if specified. More...
 
ctd::defines::List< std::string > ParNames () const
 Returns list of parameter names. More...
 
const std::map< std::string,
ctd::file::Parameter > & 
GetParameterMap () const
 Return reference to the internal map with the names/parameter objects. More...
 
const std::string & GetProcFile () const
 Return reference to file being processed (loaded). More...
 
ParameterSetoperator= (const ParameterSet &source)
 Assignment operator. More...
 
 ParameterSet ()
 
 ParameterSet (const ParameterSet &source)
 Copy constructor. More...
 
 ~ParameterSet ()
 
virtual void Load (const std::string &filename, const bool merge=false)
 Load a file containing parameters. More...
 
void Store (const std::string &par_name, const std::string &value, const std::string &comment="")
 Store a parameter name, value and possibly comment in the object. More...
 
std::string GetValueAsString (const std::string &par_name, const bool exception=false) const
 Return value for the referenced parameter as a string. More...
 
template<class TYPE >
bool GetValue (const std::string &name, TYPE &value, const bool exception=false) const
 Return value for the referenced parameter as its native data type. More...
 
const ctd::file::ParameterGetPar (const std::string &par_name) const
 Get reference to parameter object, referenced by its name. More...
 
bool HasPar (const std::string &par_name) const
 Returns true if parameter is defined. More...
 
bool HasPar (const std::string &par_name, ctd::file::Parameter &parameter) const
 Returns true if parameter defined, copies parameter object to object provided. More...
 
template<class TYPE >
bool HasPar (const std::string &par_name, TYPE &value) const
 Return trie if parameter defined, sets the value as the native value. More...
 
uint32_t Scan (const std::string &filter_reg_exp, ctd::defines::List< ctd::file::Parameter > &matches) const
 Scans through the parameter object namespace and creates list of matching parameters. More...
 
std::string Print (const std::string &filter_reg_exp="") const
 Prints out contents of object, applying regular expression filtering, if specified. More...
 
ctd::defines::List< std::string > ParNames () const
 Returns list of parameter names. More...
 
const std::map< std::string,
ctd::file::Parameter > & 
GetParameterMap () const
 Return reference to the internal map with the names/parameter objects. More...
 
const std::string & GetProcFile () const
 Return reference to file being processed (loaded). More...
 
ParameterSetoperator= (const ParameterSet &source)
 Assignment operator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ctd::file::ParameterSet
static std::string Print (ctd::defines::List< ctd::file::Parameter > &par_list)
 Create an ASCII print out of the parameters in the list. More...
 
static std::string Print (ctd::defines::List< ctd::file::Parameter > &par_list)
 Create an ASCII print out of the parameters in the list. More...
 
static std::string Print (ctd::defines::List< ctd::file::Parameter > &par_list)
 Create an ASCII print out of the parameters in the list. More...
 
- Protected Member Functions inherited from ctd::file::ParameterSet
void _Copy (const ParameterSet &source)
 
void _Copy (const ParameterSet &source)
 
void _Copy (const ParameterSet &source)
 
- Protected Attributes inherited from ctd::file::ParameterSet
std::map< std::string,
ctd::file::Parameter
m_par_map
 
std::string m_proc_file
 
ctd::defines::List< std::string > m_loaded_files
 

Detailed Description

Class implementing the handling of Yaml files in the ICS environment.

Basically the keys in the Yaml file are extracted and stored in a ctd::file::ParameterSet object, from which the Yaml class is derived.

Constructor & Destructor Documentation

ctd::file::Yaml::Yaml ( )
ctd::file::Yaml::~Yaml ( )
ctd::file::Yaml::Yaml ( )
ctd::file::Yaml::~Yaml ( )
ctd::file::Yaml::Yaml ( )
ctd::file::Yaml::~Yaml ( )

Member Function Documentation

void ctd::file::Yaml::LoadUser ( const std::string &  file_name,
const bool  merge = false 
)
virtual

Load the Yaml file and convert its contents into a dictionary.

Parameters
file_nameName of Yaml file to load.
mergeIf true, the key/value sets of multiple Yaml files is merged.

Parse the content of the Yaml file and convert create keys as follows, e.g.:

Detector*.Window*.StartX: Class: (Configuration) Type: Float Format: .1f

is mapped into the following key/value sets:

Detector*.Window*.StartX = "" Detector*.Window*.StartX::Class = "(Configuration)" Detector*.Window*.StartX::Type = "Float" Detector*.Window*.StartX::Format = ".1f"

Reimplemented from ctd::file::ParameterSet.

virtual void ctd::file::Yaml::LoadUser ( const std::string &  file_name,
const bool  merge = false 
)
virtual

Load the Yaml file and convert its contents into a dictionary.

Parameters
file_nameName of Yaml file to load.
mergeIf true, the key/value sets of multiple Yaml files is merged.

Parse the content of the Yaml file and convert create keys as follows, e.g.:

Detector*.Window*.StartX: Class: (Configuration) Type: Float Format: .1f

is mapped into the following key/value sets:

Detector*.Window*.StartX = "" Detector*.Window*.StartX::Class = "(Configuration)" Detector*.Window*.StartX::Type = "Float" Detector*.Window*.StartX::Format = ".1f"

Reimplemented from ctd::file::ParameterSet.

virtual void ctd::file::Yaml::LoadUser ( const std::string &  file_name,
const bool  merge = false 
)
virtual

Load the Yaml file and convert its contents into a dictionary.

Parameters
file_nameName of Yaml file to load.
mergeIf true, the key/value sets of multiple Yaml files is merged.

Parse the content of the Yaml file and convert create keys as follows, e.g.:

Detector*.Window*.StartX: Class: (Configuration) Type: Float Format: .1f

is mapped into the following key/value sets:

Detector*.Window*.StartX = "" Detector*.Window*.StartX::Class = "(Configuration)" Detector*.Window*.StartX::Type = "Float" Detector*.Window*.StartX::Format = ".1f"

Reimplemented from ctd::file::ParameterSet.


The documentation for this class was generated from the following files: