Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hammer::SettingsConsumer Class Referenceabstract

Base class to access the settings repository. More...

#include <SettingsConsumer.hh>

+ Inheritance diagram for Hammer::SettingsConsumer:
+ Collaboration diagram for Hammer::SettingsConsumer:

Public Member Functions

virtual void setSettingsHandler (SettingsHandler &sh)
 set link to settings repository handler. More...
 
void setSettingsHandler (const SettingsConsumer &other)
 
SettingsHandlergetSettingsHandler () const
 provide the pointer to the repository handler More...
 
WTerm setWeightTerm (WTerm group)
 
virtual void addRefs () const
 
Constructors
 SettingsConsumer ()
 base constructor More...
 
 SettingsConsumer (const SettingsConsumer &)=default
 default copy constructor More...
 
SettingsConsumeroperator= (const SettingsConsumer &)=default
 
virtual ~SettingsConsumer ()
 virtual destructor More...
 

Protected Member Functions

virtual void defineSettings ()=0
 purely virtual function for a class to define new settings More...
 
LoggetLog () const
 logging facility More...
 
void initSettings ()
 
void setPath (const std::string &path)
 provide the basic path for the settings defined by this class, as in "<path>:<setting>" More...
 
template<typename T >
void addSetting (const std::string &name, const T &defaultValue)
 template method to add a new setting More...
 
void removeSetting (const std::string &name)
 
template<typename T >
T * getSetting (const std::string &name) const
 template method to return a setting defined by this class More...
 
template<typename T >
T * getSetting (const std::string &otherPath, const std::string &name) const
 template method to return a setting defined by this class More...
 
bool isOn (const std::string &name) const
 method to check a boolean setting defined by this class More...
 
bool isOn (const std::string &otherPath, const std::string &name) const
 method to check a boolean setting by its name and path More...
 
template<typename T >
void updateVectorOfSettings (const std::vector< T > &values, const std::vector< std::string > &names, const std::string &path="", WTerm group=WTerm::COMMON)
 
template<typename T >
void updateVectorOfSettings (const std::map< std::string, T > &values, const std::string &path="", WTerm group=WTerm::COMMON)
 

Protected Attributes

SettingsHandler_settingHandler
 pointer to the settings repository handler. More...
 
std::string _settingPath
 path of the settings defined by this class More...
 
WTerm _group
 
std::set< std::string > _ownedSettings
 

Private Member Functions

void checkAndCleanSettings ()
 

Detailed Description

Base class to access the settings repository.

Implements the basic interface for querying and defining settings

Definition at line 28 of file SettingsConsumer.hh.

Constructor & Destructor Documentation

Hammer::SettingsConsumer::SettingsConsumer ( )

base constructor

Definition at line 18 of file SettingsConsumer.cc.

Hammer::SettingsConsumer::SettingsConsumer ( const SettingsConsumer )
default

default copy constructor

virtual Hammer::SettingsConsumer::~SettingsConsumer ( )
inlinevirtual

virtual destructor

Definition at line 43 of file SettingsConsumer.hh.

Member Function Documentation

template<typename T >
void Hammer::SettingsConsumer::addSetting ( const std::string &  name,
const T &  defaultValue 
)
protected

template method to add a new setting

Parameters
[in]namethe name of the setting
[in]defaultValuedefault value of the setting

Definition at line 19 of file SettingsConsumerDefs.hh.

void Hammer::SettingsConsumer::checkAndCleanSettings ( )
private

Definition at line 95 of file SettingsConsumer.cc.

Log & Hammer::SettingsConsumer::getLog ( ) const
protected

logging facility

Returns
stream to be used for logging

Definition at line 110 of file SettingsConsumer.cc.

template<typename T >
T * Hammer::SettingsConsumer::getSetting ( const std::string &  name) const
protected

template method to return a setting defined by this class

Parameters
[in]namethe name of the setting
Returns
a pointer to the setting value (null if the setting is not present or is of a different type)

Definition at line 29 of file SettingsConsumerDefs.hh.

template<typename T >
T * Hammer::SettingsConsumer::getSetting ( const std::string &  otherPath,
const std::string &  name 
) const
protected

template method to return a setting defined by this class

Parameters
[in]otherPaththe name of the setting
[in]namethe name of the setting
Returns
a pointer to the setting value (null if the setting is not present or is of a different type)

Definition at line 38 of file SettingsConsumerDefs.hh.

SettingsHandler * Hammer::SettingsConsumer::getSettingsHandler ( ) const

provide the pointer to the repository handler

Returns
the settings handler

Definition at line 61 of file SettingsConsumer.cc.

void Hammer::SettingsConsumer::initSettings ( )
protected

Definition at line 38 of file SettingsConsumer.cc.

bool Hammer::SettingsConsumer::isOn ( const std::string &  name) const
protected

method to check a boolean setting defined by this class

Parameters
[in]namethe name of the setting
Returns
the status of the setting

Definition at line 25 of file SettingsConsumer.cc.

bool Hammer::SettingsConsumer::isOn ( const std::string &  otherPath,
const std::string &  name 
) const
protected

method to check a boolean setting by its name and path

Parameters
[in]otherPaththe path of the setting
[in]namethe name of the setting
Returns
the status of the setting

Definition at line 48 of file SettingsConsumer.cc.

SettingsConsumer& Hammer::SettingsConsumer::operator= ( const SettingsConsumer )
default
void Hammer::SettingsConsumer::removeSetting ( const std::string &  name)
protected
Parameters
[in]name

Definition at line 87 of file SettingsConsumer.cc.

void Hammer::SettingsConsumer::setPath ( const std::string &  path)
protected

provide the basic path for the settings defined by this class, as in "<path>:<setting>"

Parameters
[in]paththe class name/path

Definition at line 21 of file SettingsConsumer.cc.

void Hammer::SettingsConsumer::setSettingsHandler ( SettingsHandler sh)
virtual

set link to settings repository handler.

Parameters
[in]shthe settings handler

Reimplemented in Hammer::DictionaryManager, Hammer::ProcManager, and Hammer::ProvidersRepo.

Definition at line 65 of file SettingsConsumer.cc.

void Hammer::SettingsConsumer::setSettingsHandler ( const SettingsConsumer other)

Definition at line 73 of file SettingsConsumer.cc.

WTerm Hammer::SettingsConsumer::setWeightTerm ( WTerm  group)

Definition at line 81 of file SettingsConsumer.cc.

template<typename T >
void Hammer::SettingsConsumer::updateVectorOfSettings ( const std::vector< T > &  values,
const std::vector< std::string > &  names,
const std::string &  path = "",
WTerm  group = WTerm::COMMON 
)
protected

Definition at line 47 of file SettingsConsumerDefs.hh.

template<typename T >
void Hammer::SettingsConsumer::updateVectorOfSettings ( const std::map< std::string, T > &  values,
const std::string &  path = "",
WTerm  group = WTerm::COMMON 
)
protected

Definition at line 62 of file SettingsConsumerDefs.hh.

Member Data Documentation

WTerm Hammer::SettingsConsumer::_group
protected

Definition at line 135 of file SettingsConsumer.hh.

std::set<std::string> Hammer::SettingsConsumer::_ownedSettings
protected

Definition at line 137 of file SettingsConsumer.hh.

SettingsHandler* Hammer::SettingsConsumer::_settingHandler
protected

pointer to the settings repository handler.

Static allows to be initialized once (usually in Run class) and shared among all other SettingsConsumer derived classes

Definition at line 130 of file SettingsConsumer.hh.

std::string Hammer::SettingsConsumer::_settingPath
protected

path of the settings defined by this class

Definition at line 133 of file SettingsConsumer.hh.


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