Belle II Software development
ModuleParamBase Class Referenceabstract

Base class for module parameter. More...

#include <ModuleParamBase.h>

Inheritance diagram for ModuleParamBase:
ModuleParam< bool > ModuleParam< T >

Public Member Functions

 ModuleParamBase (std::string typeInfo, std::string description, bool force)
 Constructor.
 
virtual ~ModuleParamBase ()
 Destructor.
 
const std::string & getTypeInfo () const
 Returns the type identifier of the parameter as string.
 
const std::string & getDescription () const
 Returns the description of the parameter.
 
bool isSetInSteering () const
 Returns true if the parameter was set in the steering file.
 
bool isForcedInSteering () const
 Returns true if the parameter has to be set by the user in the steering file.
 
virtual void setValueFromPythonObject (const boost::python::object &pyObject)=0
 Pure virtual function.
 
virtual void setValueToPythonObject (boost::python::object &pyObject, bool defaultValues=false) const =0
 Pure virtual function.
 
virtual void setValueFromParam (const ModuleParamBase &param)=0
 Set value from other ModuleParam of same type.
 

Protected Attributes

std::string m_typeInfo
 The type of the parameter stored as string.
 
std::string m_description
 The (optional) description of the parameter.
 
bool m_forceInSteering
 If true the parameter has to be set by the user in the steering file.
 
bool m_setInSteering
 True, if the parameter value was changed in the steering file.
 

Detailed Description

Base class for module parameter.

The base class stores all common information for parameters.

Definition at line 31 of file ModuleParamBase.h.

Constructor & Destructor Documentation

◆ ModuleParamBase()

ModuleParamBase ( std::string  typeInfo,
std::string  description,
bool  force 
)

Constructor.

Parameters
typeInfoThe type string of the parameter.
descriptionThe description of the parameter.
forceIf true the parameter has to be set in the steering file by the user.

Definition at line 15 of file ModuleParamBase.cc.

16 : m_typeInfo(std::move(typeInfo))
17 , m_description(std::move(description))
18 , m_forceInSteering(force)
19 , m_setInSteering(false)
20{
21}
bool m_forceInSteering
If true the parameter has to be set by the user in the steering file.
std::string m_typeInfo
The type of the parameter stored as string.
bool m_setInSteering
True, if the parameter value was changed in the steering file.
std::string m_description
The (optional) description of the parameter.

Member Function Documentation

◆ getDescription()

const std::string & getDescription ( ) const

Returns the description of the parameter.

Returns
The description of the parameter.

Definition at line 30 of file ModuleParamBase.cc.

31{
32 return m_description;
33}

◆ getTypeInfo()

const std::string & getTypeInfo ( ) const

Returns the type identifier of the parameter as string.

The type identifier is used to discriminate between problematic parameter types (e.g. double and int).

Returns
The type identifier as string.

Definition at line 25 of file ModuleParamBase.cc.

26{
27 return m_typeInfo;
28}

◆ isForcedInSteering()

bool isForcedInSteering ( ) const

Returns true if the parameter has to be set by the user in the steering file.

Returns
True if the parameter has to be set in the steering file.

Definition at line 40 of file ModuleParamBase.cc.

41{
42 return m_forceInSteering;
43}

◆ isSetInSteering()

bool isSetInSteering ( ) const

Returns true if the parameter was set in the steering file.

If the value was not set in the steering file but is still the default value, this method returns false.

Returns
True if the parameter was set in the steering file.

Definition at line 35 of file ModuleParamBase.cc.

36{
37 return m_setInSteering;
38}

◆ setValueFromParam()

virtual void setValueFromParam ( const ModuleParamBase param)
pure virtual

Set value from other ModuleParam of same type.

Implemented in ModuleParam< T >, and ModuleParam< bool >.

◆ setValueFromPythonObject()

virtual void setValueFromPythonObject ( const boost::python::object &  pyObject)
pure virtual

Pure virtual function.

Set the value of the parameter from a python object. The derived templated ModuleParam class calls the converter functions in PyObjConvUtils.h with the right template arguments. Hence the compiler can automatically infer the right converter.

Parameters
pyObjectThe python object which holds the parameter value

Implemented in ModuleParam< T >, and ModuleParam< bool >.

◆ setValueToPythonObject()

virtual void setValueToPythonObject ( boost::python::object &  pyObject,
bool  defaultValues = false 
) const
pure virtual

Pure virtual function.

Set the value of a python objects to stored parameter value. The derived templated ModuleParam class calls the converter functions in PyObjConvUtils.h with the right template arguments. Hence the compiler can automatically infer the right converters

Parameters
pyObjectThe python object which should be filled with the parameter value
defaultValuesIf true, the python object is set to the default value of this parameter.

Implemented in ModuleParam< T >, and ModuleParam< bool >.

Member Data Documentation

◆ m_description

std::string m_description
protected

The (optional) description of the parameter.

Definition at line 113 of file ModuleParamBase.h.

◆ m_forceInSteering

bool m_forceInSteering
protected

If true the parameter has to be set by the user in the steering file.

Definition at line 116 of file ModuleParamBase.h.

◆ m_setInSteering

bool m_setInSteering
protected

True, if the parameter value was changed in the steering file.

Definition at line 119 of file ModuleParamBase.h.

◆ m_typeInfo

std::string m_typeInfo
protected

The type of the parameter stored as string.

Definition at line 110 of file ModuleParamBase.h.


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