22 #include <momemta/impl/Pool.h> 23 #include <momemta/InputTag.h> 24 #include <momemta/ModuleRegistry.h> 40 enum class Status: std::int8_t {
47 using std::runtime_error::runtime_error;
50 static std::string statusToString(
const Status& status);
61 Module(PoolPtr pool,
const std::string& name):
62 m_name(name), m_pool(pool) {
97 virtual Status
work() {
return Status::OK; };
123 virtual std::string name()
const final {
136 return (name ==
"momemta") || (name ==
"input") || (name ==
"cuba");
161 template<
typename T,
typename... Args> std::shared_ptr<T>
produce(
const std::string& name, Args... args) {
162 return m_pool->put<T>({m_name, name}, std::forward<Args>(args)...);
165 template<
typename T>
Value<T> get(
const std::string& module,
const std::string& name) {
166 return m_pool->get<T>({module, name});
170 return m_pool->get<T>(tag);
175 const std::string m_name;
182 using ModulePtr = std::shared_ptr<Module>;
virtual void endIntegration()
Called once at the end of the integration.
virtual void configure()
Called once at the beginning of the job.
virtual void finish()
Called once at the end of the job.
virtual Status work()
Main function.
static bool is_virtual_module(const std::string &name)
Test if a given name correspond to a virtual module.
virtual void beginLoop()
Called once at the beginning of a loop.
virtual void beginPoint()
Called once when a new PS point is started.
Parent class for all the modules.
std::shared_ptr< T > produce(const std::string &name, Args... args)
Add a new output to the module.
A class representing a value produced by a module.
Module(PoolPtr pool, const std::string &name)
Constructor.
virtual void endPoint()
Called once when a PS point is finished.
virtual void endLoop()
Called once at the end of a loop.
virtual void beginIntegration()
Called once at the beginning of the integration.