ifw-core  3.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ctd::file::ParameterFile Class Reference

Class to handle a set of parameters. More...

#include <ParameterFile.hpp>

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

Public Member Functions

 ParameterFile ()
 
 ParameterFile (const ParameterFile &source)
 Copy constructor. More...
 
 ~ParameterFile ()
 
virtual void Load (const std::string &filename, const bool merge=false)
 Load a file containing parameters. More...
 
virtual void LoadUser (const std::string &filename, const bool merge=false)
 
const std::string & GetProcFile () const
 Return reference to file being processed (loaded). More...
 
ParameterFileoperator= (const ParameterFile &source)
 Assignment operator. More...
 
- Public Member Functions inherited from ctd::param::ParameterSet
 ParameterSet ()
 
 ParameterSet (const ParameterSet &source)
 Copy constructor. More...
 
 ~ParameterSet ()
 
ParameterSetClear ()
 Clear the object. 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 GetValue (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::param::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::param::Parameter &parameter) const
 Returns true if parameter defined, copies parameter object to object provided. More...
 
bool HasPar (const std::string &par_name, std::string &value) const
 Returns true if parameter defined and copies value into "value" parameter. More...
 
template<class TYPE >
bool HasPar (const std::string &par_name, TYPE &value) const
 Return true if parameter defined, sets the value as the native value. More...
 
uint32_t Scan (const std::string &filter_reg_exp, std::vector< ctd::param::Parameter > &matches) const
 Scans through the parameter object namespace and creates list of matching parameters. More...
 
std::string ToString (const std::string &filter_reg_exp="") const
 Prints out contents of object, applying regular expression filtering, if specified. More...
 
std::vector< std::string > ParNames () const
 Returns list of parameter names. More...
 
const std::map< std::string, ctd::param::Parameter > & GetParameterMap () const
 Return reference to the internal map with the names/parameter objects. More...
 
void Merge (const ParameterSet &source_set)
 Merge the parameters of the source into this instance. More...
 
ParameterSetoperator= (const ParameterSet &source)
 Assignment operator. More...
 

Protected Member Functions

void _Copy (const ParameterFile &source)
 
- Protected Member Functions inherited from ctd::param::ParameterSet
void _Copy (const ParameterSet &source)
 

Protected Attributes

std::string m_proc_file
 
std::vector< std::string > m_loaded_files
 
- Protected Attributes inherited from ctd::param::ParameterSet
std::map< std::string, ctd::param::Parameterm_par_map
 

Additional Inherited Members

- Static Public Member Functions inherited from ctd::param::ParameterSet
static std::string ToString (std::vector< ctd::param::Parameter > &par_list)
 Create an ASCII print out of the parameters in the list. More...
 

Detailed Description

Class to handle a set of parameters.

Constructor & Destructor Documentation

◆ ParameterFile() [1/2]

ctd::file::ParameterFile::ParameterFile ( )

◆ ParameterFile() [2/2]

ctd::file::ParameterFile::ParameterFile ( const ParameterFile source)

Copy constructor.

◆ ~ParameterFile()

ctd::file::ParameterFile::~ParameterFile ( )

Member Function Documentation

◆ _Copy()

void ctd::file::ParameterFile::_Copy ( const ParameterFile source)
protected

◆ GetProcFile()

const std::string & ctd::file::ParameterFile::GetProcFile ( ) const

Return reference to file being processed (loaded).

◆ Load()

void ctd::file::ParameterFile::Load ( const std::string &  filename,
const bool  merge = false 
)
virtual

Load a file containing parameters.

◆ LoadUser()

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

Method to load the parameters from a simple format file containing parameters. The following rules are applied while parsing the file:

  • Lines initiated with "#" are ignored.
  • Lines containing <parameter>: "<value>" are split and added in the internal map. The value shall be contained between ""'s.
  • Inline comments are allowed, i.e.: "<parameter>: "

" # <comment".

Reimplemented in ctd::file::Yaml.

◆ operator=()

ParameterFile & ctd::file::ParameterFile::operator= ( const ParameterFile source)

Assignment operator.

Member Data Documentation

◆ m_loaded_files

std::vector<std::string> ctd::file::ParameterFile::m_loaded_files
protected

◆ m_proc_file

std::string ctd::file::ParameterFile::m_proc_file
protected

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