15#ifndef DFMODULES_INCLUDE_DFMODULES_DATASTORE_HPP_
16#define DFMODULES_INCLUDE_DFMODULES_DATASTORE_HPP_
20#include "cetlib/BasicPluginFactory.h"
21#include "cetlib/compiler_macros.h"
28#include "nlohmann/json.hpp"
36#ifndef EXTERN_C_FUNC_DECLARE_START
38#define EXTERN_C_FUNC_DECLARE_START \
47#define DEFINE_DUNE_DATA_STORE(klass) \
48 EXTERN_C_FUNC_DECLARE_START \
49 std::shared_ptr<dunedaq::dfmodules::DataStore> make(const std::string& name, \
50 std::shared_ptr<dunedaq::appfwk::ConfigurationManager> mcfg, \
51 const std::string& writer_name ) \
53 return std::shared_ptr<dunedaq::dfmodules::DataStore>(new klass(name, mcfg, writer_name)); \
64 DataStoreCreationFailed,
65 "Failed to create DataStore " << plugin_name <<
" with name " << name,
66 ((std::string)plugin_name)((std::string)name)
76 RetryableDataStoreProblem,
77 "Module " << mod_name <<
": A problem was encountered when " << description,
78 ((std::string)mod_name)((std::string)description))
87 IgnorableDataStoreProblem,
88 "Module " << mod_name <<
": A problem was encountered when " << description,
89 ((std::string)mod_name)((std::string)description))
98 GeneralDataStoreProblem,
99 "Module " << mod_name <<
": A problem was encountered when " << description,
100 ((std::string)mod_name)((std::string)description))
116 : utilities::NamedObject(name), MonitorableObject()
139 bool run_is_for_test_purposes) = 0;
163inline std::shared_ptr<DataStore>
165 const std::string& name,
166 std::shared_ptr<dunedaq::appfwk::ConfigurationManager> mcfg,
167 const std::string& writer_identifier)
169 static cet::BasicPluginFactory bpf(
"duneDataStore",
"make");
171 std::shared_ptr<DataStore> ds;
173 ds = bpf.makePlugin<std::shared_ptr<DataStore>>(
type, name, mcfg, writer_identifier);
174 }
catch (
const cet::exception& cexpt) {
175 throw DataStoreCreationFailed(
ERS_HERE, type, name, cexpt);
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
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.
Implements the Named interface.
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.
Unknown serialization type