11#include <framework/core/ModuleParamList.h>
12#include <framework/core/ModuleParamList.templateDetails.h>
13#include <framework/core/ModuleCondition.h>
14#include <framework/core/PathElement.h>
16#include <framework/logging/LogConfig.h>
133 [[deprecated(
"will be removed in release-05.")]]
134 virtual std::vector<std::string>
getFileNames(__attribute__((unused))
bool outputFiles)
136 return std::vector<std::string>();
192 const std::string&
getType()
const;
253 void setLogInfo(
int logLevel,
unsigned int logInfo);
271 void if_value(
const std::string& expression,
const std::shared_ptr<Path>& path,
388 std::shared_ptr<PathElement>
clone()
const override;
457 void setType(
const std::string& type);
468 void addParam(
const std::string& name, T& paramVariable,
const std::string& description,
const T& defaultValue);
479 void addParam(
const std::string& name, T& paramVariable,
const std::string& description);
506 std::list<ModulePtr>
getModules()
const override {
return std::list<ModulePtr>(); }
539 void setParamPython(
const std::string& name,
const boost::python::object& pyObj);
560 void Module::addParam(
const std::string& name, T& paramVariable,
const std::string& description,
const T& defaultValue)
567 void Module::addParam(
const std::string& name, T& paramVariable,
const std::string& description)
650#define REG_MODULE(moduleName) namespace { struct ModuleProxy##moduleName: public ModuleProxyBase { \
651 ModuleProxy##moduleName(): ModuleProxyBase(#moduleName, "" _PACKAGE_) {} \
652 virtual ::Belle2::Module* createInstance() const override final { return new moduleName##Module(); } \
653 } proxy##moduleName##Module; }
Wraps a condition set on a Module instance.
EAfterConditionPath
Different options for behaviour after a conditional path was executed.
The Module parameter list class.
A single parameter of the module.
The base module proxy class is used to create new instances of a module.
const std::string & getModuleName() const
Returns the module name of the module associated to this proxy.
virtual ~ModuleProxyBase()
The destructor of the ModuleProxyBase class.
ModulePtr createModule() const
Abstract method which creates a new module and returns a shared pointer to it.
virtual Module * createInstance() const =0
create a new instance of the module in question
std::string m_moduleType
The type name of the module.
std::string m_package
Package this module is found in (may be empty).
void setLogLevel(int logLevel)
Configure the log level.
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
LogConfig & getLogConfig()
Returns the log system configuration.
const ModuleCondition * getCondition() const
Return a pointer to the first condition (or nullptr, if none was set)
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
void setDescription(const std::string &description)
Sets the description of the module.
const ModuleParamList & getParamList() const
Return module param list.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
const std::string & getName() const
Returns the name of the module.
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
virtual void def_endRun()
This method can receive that the current run ends as a call from the Python side.
std::vector< std::shared_ptr< Path > > getAllConditionPaths() const
Return all condition paths currently set (no matter if the condition is true or not).
int m_returnValue
The return value.
const std::string & getType() const
Returns the type of the module (i.e.
void setReturnValue(int value)
Sets the return value for this module as integer.
EModulePropFlags
Each module can be tagged with property flags, which indicate certain features of the module.
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
@ c_Input
This module is an input module (reads data).
@ c_DontCollectStatistics
No statistics is collected for this module.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
@ c_Output
This module is an output module (writes data).
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
void setLogConfig(const LogConfig &logConfig)
Set the log system configuration.
const std::string & getDescription() const
Returns the description of the module.
virtual void event()
This method is the core of the module.
virtual void initialize()
Initialize the Module.
void setAbortLevel(int abortLevel)
Configure the abort log level.
virtual void def_terminate()
Wrapper method for the virtual function terminate() that has the implementation to be used in a call ...
virtual void beginRun()
Called when entering a new run.
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
virtual void def_initialize()
Wrappers to make the methods without "def_" prefix callable from Python.
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
bool hasReturnValue() const
Return true if this module has a valid return value set.
virtual void endRun()
This method is called if the current run ends.
bool hasCondition() const
Returns true if at least one condition was set for the module.
std::shared_ptr< Path > getConditionPath() const
Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
std::string m_type
The type of the module, saved as a string.
bool m_hasReturnValue
True, if the return value is set.
virtual void def_beginRun()
Wrapper method for the virtual function beginRun() that has the implementation to be used in a call f...
const std::string & getPackage() const
Returns the package this module is in.
virtual std::vector< std::string > getFileNames(bool outputFiles)
Return a list of output filenames for this modules.
void setName(const std::string &name)
Set the name of the module.
void setType(const std::string &type)
Set the module type.
static void exposePythonAPI()
Exposes methods of the Module class to Python.
LogConfig m_logConfig
The log system configuration of the module.
Module::EAfterConditionPath getAfterConditionPath() const
What to do after the conditional path is finished.
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
void setParamList(const ModuleParamList ¶ms)
Replace existing parameter list.
std::shared_ptr< PathElement > clone() const override
Create an independent copy of this module.
bool hasProperties(unsigned int propertyFlags) const
Returns true if all specified property flags are available in this module.
std::string m_description
The description of the module.
virtual void def_event()
Wrapper method for the virtual function event() that has the implementation to be used in a call from...
std::string m_name
The name of the module, saved as a string (user-modifiable)
ModuleCondition::EAfterConditionPath EAfterConditionPath
Forward the EAfterConditionPath definition from the ModuleCondition.
std::list< ModulePtr > getModules() const override
no submodules, return empty list
bool evalCondition() const
If at least one condition was set, it is evaluated and true returned if at least one condition return...
virtual void terminate()
This method is called at the end of the event processing.
int getReturnValue() const
Return the return value set by this module.
void setParamPythonDict(const boost::python::dict &dictionary)
Implements a method for reading the parameter values from a boost::python dictionary.
std::string m_package
Package this module is found in (may be empty).
void setLogInfo(int logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
bool hasUnsetForcedParams() const
Returns true and prints error message if the module has unset parameters which the user has to set in...
const std::vector< ModuleCondition > & getAllConditions() const
Return all set conditions for this module.
std::string getPathString() const override
return the module name.
Base for classes that can be elements of a Path.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
ModuleParam< T > & getParam(const std::string &name) const
Returns a reference to a parameter.
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
std::list< ModulePtr > ModulePtrList
Defines a std::list of shared module pointers.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.