14#ifndef DFMODULES_INCLUDE_DFMODULES_DATASTORE_HPP_
15#define DFMODULES_INCLUDE_DFMODULES_DATASTORE_HPP_
18#include "cetlib/BasicPluginFactory.h"
19#include "cetlib/compiler_macros.h"
27#include "nlohmann/json.hpp"
35#ifndef EXTERN_C_FUNC_DECLARE_START
37#define EXTERN_C_FUNC_DECLARE_START \
46#define DEFINE_DUNE_DATA_STORE(klass) \
47 EXTERN_C_FUNC_DECLARE_START \
48 std::shared_ptr<dunedaq::dfmodules::DataStore> make(const std::string& name, \
49 std::shared_ptr<dunedaq::appfwk::ConfigurationManager> mcfg, \
50 const std::string& writer_name) \
52 return std::shared_ptr<dunedaq::dfmodules::DataStore>(new klass(name, mcfg, writer_name)); \
63 DataStoreCreationFailed,
64 "Failed to create DataStore " << plugin_name <<
" with name " << name,
65 ((std::string)plugin_name)((std::string)name)
75 RetryableDataStoreProblem,
76 "Module " << mod_name <<
": A problem was encountered when " << description,
77 ((std::string)mod_name)((std::string)description))
86 IgnorableDataStoreProblem,
87 "Module " << mod_name <<
": A problem was encountered when " << description,
88 ((std::string)mod_name)((std::string)description))
156inline std::shared_ptr<DataStore>
158 const std::string& name,
159 std::shared_ptr<dunedaq::appfwk::ConfigurationManager> mcfg,
160 const std::string& writer_identifier)
162 static cet::BasicPluginFactory bpf(
"duneDataStore",
"make");
164 std::shared_ptr<DataStore> ds;
166 ds = bpf.makePlugin<std::shared_ptr<DataStore>>(type, name, mcfg, writer_identifier);
167 }
catch (
const cet::exception& cexpt) {
168 throw DataStoreCreationFailed(
ERS_HERE, type, name, cexpt);
DataStore & operator=(const DataStore &)=delete
virtual void write(const daqdataformats::TriggerRecord &tr)=0
Writes the TriggerRecord into the DataStore.
virtual void finish_with_run(daqdataformats::run_number_t run_number)=0
Informs the DataStore that writes or reads of data blocks associated with the specified run number ha...
DataStore & operator=(DataStore &&)=delete
DataStore(DataStore &&)=delete
DataStore(const DataStore &)=delete
virtual void write(const daqdataformats::TimeSlice &ts)=0
Writes the TimeSlice into the DataStore.
virtual void prepare_for_run(daqdataformats::run_number_t run_number, bool run_is_for_test_purposes)=0
Informs the DataStore that writes or reads of data blocks associated with the specified run number wi...
DataStore(const std::string &name)
DataStore Constructor.
MonitorableObject(const MonitorableObject &)=delete
Implements the Named interface.
NamedObject(const std::string &name)
NamedObject Constructor.
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message_, attributes)
An ERS Issue for DataStore creation failure.
std::shared_ptr< DataStore > make_data_store(const std::string &type, const std::string &name, std::shared_ptr< dunedaq::appfwk::ConfigurationManager > mcfg, const std::string &writer_identifier)
Load a DataSrore plugin and return a unique_ptr to the contained DAQModule class.