 |
Belle II Software
release-05-02-19
|
11 #include <framework/core/SwitchDataStoreModule.h>
12 #include <framework/datastore/DataStore.h>
23 setDescription(
"Internal module used by Path.add_independent_path(). This shouldn't appear in 'basf2 -m' output. If it does, check REG_MODULE() handling.");
25 addParam(
"toID", m_to,
"active DataStore id after this module", std::string(
""));
26 addParam(
"doCopy", m_doCopy,
27 "should data be copied to DataStore 'toID'? This should be true only when toID refers to a _new_ DataStore ID",
false);
28 addParam(
"mergeBack", m_mergeBack,
"if given, copy the given objects/arrays over even if doCopy is fals.", std::vector<std::string> {});
31 SwitchDataStoreModule::~SwitchDataStoreModule() =
default;
43 B2FATAL(
"identical from/to parameter value " <<
m_from);
45 B2FATAL(
"doCopy is set for default DataStore ID! This would likely cause corruption.");
47 B2FATAL(
"doCopy is not set ?");
std::string currentID() const
returns ID of current DataStore.
static DataStore & Instance()
Instance of singleton Store.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
void createNewDataStoreID(const std::string &id)
creates new datastore with given id, copying the registered objects/arrays from the current one.
void copyEntriesTo(const std::string &id, const std::vector< std::string > &entrylist_event={})
copy entries (not contents) of current DataStore to the DataStore with given ID.
void copyContentsTo(const std::string &id, const std::vector< std::string > &entrylist_event={})
copy contents (actual array / object contents) of current DataStore to the DataStore with given ID.
Abstract base class for different kinds of events.
virtual void beginRun() override
Called when entering a new run.
bool m_doCopy
should data be copied to m_to?
virtual void event() override
This method is the core of the module.
virtual void terminate() override
This method is called at the end of the event processing.
void switchID(const std::string &id)
switch to DataStore with given ID.
virtual void endRun() override
This method is called if the current run ends.
Internal module used by Path.add_independent_path().
std::string m_to
active DataStore ID after this module.
void init(const std::string &to, bool doCopy, const std::vector< std::string > &mergeBack)
setter for Path.
std::string m_from
active DataStore ID before this module.
std::vector< std::string > m_mergeBack
list of obj/arrays (of event durability) that should be copied to m_to regardless of m_doCopy.
virtual void initialize() override
Initialize the Module.