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