psana::Configurable Class Reference
[psana package]

Class that provides a simplified interface to a framework's configuration service. More...

#include <Configurable.h>

Inheritance diagram for psana::Configurable:

psana::InputModule psana::Module PSShmemInput::DgramSourceShmem PSXtcInput::DamagePolicy PSXtcInput::DgramSourceFile PSXtcInput::Index psana::EventKeys psana::PrintEventId psana::PrintSeparator List of all members.

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 &param) const
 Get the value of a single parameter, this method can be used for numeric types only.
std::string configStr (const std::string &param) const
 Get the value of a single parameter as a string.
PSEvt::Source configSrc (const std::string &param) const
 Get the value of a single parameter as a Source object.
template<typename T>
ConfigSvc::ConfigSvc::ResultDef<
T > 
config (const std::string &param, 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 &param, const std::string &def) const
 Get the value of a single parameter as a string.
PSEvt::Source configSrc (const std::string &param, const std::string &def) const
 Get the value of a single parameter as a Source object.
ConfigSvc::ConfigSvc::ResultList configList (const std::string &param) const
 Get the value of a parameter as a sequence.
template<typename T>
std::list< T > configList (const std::string &param, 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 &param, 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.

Detailed Description

Class that provides a simplified interface to a framework's configuration service.

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.

See also:
ConfigSvc::ConfigSvc
Version:
$Id: Configurable.h 10071 2015-05-12 23:28:27Z davidsch@SLAC.STANFORD.EDU $
Author:
Andrei Salnikov

Definition at line 60 of file Configurable.h.


Constructor & Destructor Documentation

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.

Parameters:
[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.


Member Function Documentation

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().

template<typename T>
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.

Parameters:
[in] param Name of the parameter
[in] def Default value to return if parameter is not there
Returns:
Parameter value or default value

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.

Parameters:
[in] param Name of the parameter
Returns:
Parameter value
Exceptions:
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().

template<typename T>
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.

Parameters:
[in] param Name of the parameter
[in] def Default value to return if parameter is not there
Returns:
The object that is convertible to a std::vector<T> for some type T

Definition at line 232 of file Configurable.h.

References className(), and name().

template<typename T>
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.

Parameters:
[in] param Name of the parameter
[in] def Default value to return if parameter is not there
Returns:
The object that is convertible to a list sequence type such as std::list<<std::string>

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.

Parameters:
[in] param Name of the parameter
Returns:
The object that is convertible to sequence type such as std::list<<std::string> or std::vector<int>
Exceptions:
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.

Parameters:
[in] param Name of the parameter
[in] def Default value to return if parameter is not there
Returns:
Parameter value or default value

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.

Parameters:
[in] param Name of the parameter
Returns:
Parameter value
Exceptions:
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.

Parameters:
[in] param Name of the parameter
[in] def Default value to return if parameter is not there
Returns:
Parameter value or default value

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.

Parameters:
[in] param Name of the parameter
Returns:
Parameter value
Exceptions:
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]

returns instance of configuration service

Definition at line 78 of file Configurable.h.

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().


The documentation for this class was generated from the following files:
Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7