#include <Configurable.h>
Inheritance diagram for psana::Configurable:
Public Member Functions | |
Configurable (const std::string &name) | |
Constructor takes a name. | |
~Configurable () | |
ConfigSvc::ConfigSvc | configSvc () const |
returns instance of configuration service | |
ConfigSvc::ConfigSvc::Result | config (const std::string ¶m) const |
Get the value of a single parameter, this method can be used for numeric types only. | |
std::string | configStr (const std::string ¶m) const |
Get the value of a single parameter as a string. | |
PSEvt::Source | configSrc (const std::string ¶m) const |
Get the value of a single parameter as a Source object. | |
template<typename T> | |
ConfigSvc::ConfigSvc::ResultDef< T > | config (const std::string ¶m, const T &def) const |
Get the value of a single parameter, this method can be used for numeric types only. | |
std::string | configStr (const std::string ¶m, const std::string &def) const |
Get the value of a single parameter as a string. | |
PSEvt::Source | configSrc (const std::string ¶m, const std::string &def) const |
Get the value of a single parameter as a Source object. | |
ConfigSvc::ConfigSvc::ResultList | configList (const std::string ¶m) const |
Get the value of a parameter as a sequence. | |
template<typename T> | |
std::list< T > | configList (const std::string ¶m, const std::list< T > &def) const |
Get the value of a parameter as a list. | |
template<typename T> | |
std::vector< T > | configList (const std::string ¶m, const std::vector< T > &def) const |
Get the value of a parameter as a vector. | |
const std::string & | name () const |
Get the full name of the object including class and instance name. | |
const std::string & | className () const |
Get the class name of the object. |
This object can be used either as a base class or a member of other classes. It does not define any virtual methods (even destructor) so make sure that classes which inherit it do it properly.
This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.
Definition at line 60 of file Configurable.h.
psana::Configurable::Configurable | ( | const std::string & | name | ) |
Constructor takes a name.
It accept names in the format "Package.ClassName" or "Package.ClassName:InstanceName". The configuration will be read from a section corresponding to this name if present of from a section without instance name.
[in] | name | Name of this configurable. |
Definition at line 39 of file Configurable.cpp.
psana::Configurable::~Configurable | ( | ) |
Definition at line 54 of file Configurable.cpp.
const std::string& psana::Configurable::className | ( | ) | const [inline] |
Get the class name of the object.
Definition at line 246 of file Configurable.h.
Referenced by config(), configList(), and configStr().
ConfigSvc::ConfigSvc::ResultDef<T> psana::Configurable::config | ( | const std::string & | param, | |
const T & | def | |||
) | const [inline] |
Get the value of a single parameter, this method can be used for numeric types only.
Returns default value if parameter is not found.
[in] | param | Name of the parameter |
[in] | def | Default value to return if parameter is not there |
Definition at line 142 of file Configurable.h.
References className().
ConfigSvc::ConfigSvc::Result psana::Configurable::config | ( | const std::string & | param | ) | const [inline] |
Get the value of a single parameter, this method can be used for numeric types only.
[in] | param | Name of the parameter |
ConfigSvc::ExceptionMissing | thrown if parameter or section is not found |
Definition at line 91 of file Configurable.h.
References className(), and name().
Referenced by PSXtcInput::DamagePolicy::DamagePolicy(), psana::EventKeys::EventKeys(), PSXtcInput::DgramSourceFile::init(), and psana::PrintSeparator::PrintSeparator().
std::vector<T> psana::Configurable::configList | ( | const std::string & | param, | |
const std::vector< T > & | def | |||
) | const [inline] |
Get the value of a parameter as a vector.
Returns default vector if parameter is not found.
[in] | param | Name of the parameter |
[in] | def | Default value to return if parameter is not there |
Definition at line 232 of file Configurable.h.
References className(), and name().
std::list<T> psana::Configurable::configList | ( | const std::string & | param, | |
const std::list< T > & | def | |||
) | const [inline] |
Get the value of a parameter as a list.
Returns default list if parameter is not found.
[in] | param | Name of the parameter |
[in] | def | Default value to return if parameter is not there |
Definition at line 212 of file Configurable.h.
References className(), and name().
ConfigSvc::ConfigSvc::ResultList psana::Configurable::configList | ( | const std::string & | param | ) | const [inline] |
Get the value of a parameter as a sequence.
[in] | param | Name of the parameter |
ConfigSvc::ExceptionMissing | thrown if parameter or section is not found |
Definition at line 192 of file Configurable.h.
References className(), and name().
Referenced by PSXtcInput::DgramSourceFile::DgramSourceFile(), PSXtcInput::Index::Index(), PSXtcInput::DgramSourceFile::init(), and PSShmemInput::DgramSourceShmem::init().
PSEvt::Source psana::Configurable::configSrc | ( | const std::string & | param, | |
const std::string & | def | |||
) | const [inline] |
Get the value of a single parameter as a Source object.
Returns default value if parameter is not found.
[in] | param | Name of the parameter |
[in] | def | Default value to return if parameter is not there |
Definition at line 178 of file Configurable.h.
References configStr().
PSEvt::Source psana::Configurable::configSrc | ( | const std::string & | param | ) | const [inline] |
Get the value of a single parameter as a Source object.
[in] | param | Name of the parameter |
ConfigSvc::ExceptionMissing | thrown if parameter or section is not found |
Definition at line 127 of file Configurable.h.
References configStr().
std::string psana::Configurable::configStr | ( | const std::string & | param, | |
const std::string & | def | |||
) | const [inline] |
Get the value of a single parameter as a string.
Returns default value if parameter is not found.
[in] | param | Name of the parameter |
[in] | def | Default value to return if parameter is not there |
Definition at line 159 of file Configurable.h.
References className(), and name().
std::string psana::Configurable::configStr | ( | const std::string & | param | ) | const [inline] |
Get the value of a single parameter as a string.
[in] | param | Name of the parameter |
ConfigSvc::ExceptionMissing | thrown if parameter or section is not found |
Definition at line 109 of file Configurable.h.
References className(), and name().
Referenced by configSrc(), PSXtcInput::DgramSourceFile::init(), PSShmemInput::DgramSourceShmem::init(), and psana::PrintSeparator::PrintSeparator().
ConfigSvc::ConfigSvc psana::Configurable::configSvc | ( | ) | const [inline] |
const std::string& psana::Configurable::name | ( | ) | const [inline] |
Get the full name of the object including class and instance name.
Definition at line 243 of file Configurable.h.
Referenced by psana::PrintEventId::beginCalibCycle(), psana::EventKeys::beginCalibCycle(), psana::PrintEventId::beginJob(), psana::EventKeys::beginJob(), psana::PrintEventId::beginRun(), psana::EventKeys::beginRun(), config(), configList(), configStr(), psana::PrintEventId::endCalibCycle(), psana::EventKeys::endCalibCycle(), psana::PrintEventId::endJob(), psana::EventKeys::endJob(), psana::PrintEventId::endRun(), psana::EventKeys::endRun(), psana::EventKeys::event(), PSXtcInput::DamagePolicy::eventDamagePolicy(), PSXtcInput::DgramSourceFile::init(), psana::PrintEventId::printId(), PSXtcInput::DgramSourceFile::~DgramSourceFile(), and PSShmemInput::DgramSourceShmem::~DgramSourceShmem().