00001 #ifndef artdaq_Application_MPI2_DataReceiverCore_hh
00002 #define artdaq_Application_MPI2_DataReceiverCore_hh
00003
00004 #include <string>
00005 #include <atomic>
00006 #include <map>
00007
00008 #include "fhiclcpp/ParameterSet.h"
00009 #include "canvas/Persistency/Provenance/RunID.h"
00010
00011 #include "artdaq-utilities/Plugins/MetricManager.hh"
00012
00013 #include "artdaq/DAQrate/DataReceiverManager.hh"
00014 #include "artdaq/Application/StatisticsHelper.hh"
00015
00016 namespace artdaq
00017 {
00018 class DataReceiverCore;
00019 }
00020
00025 class artdaq::DataReceiverCore
00026 {
00027 public:
00028
00032 DataReceiverCore();
00033
00037 DataReceiverCore(DataReceiverCore const&) = delete;
00038
00042 virtual ~DataReceiverCore();
00043
00048 DataReceiverCore& operator=(DataReceiverCore const&) = delete;
00049
00069 virtual bool initialize(fhicl::ParameterSet const& pset) = 0;
00070
00076 bool start(art::RunID id);
00077
00082 bool stop();
00083
00088 bool pause();
00089
00094 bool resume();
00095
00100 bool shutdown();
00101
00107 bool soft_initialize(fhicl::ParameterSet const& pset);
00108
00114 bool reinitialize(fhicl::ParameterSet const& pset);
00115
00121 bool rollover_subrun(uint64_t eventNum);
00122
00134 std::string report(std::string const& which) const;
00135
00141 bool add_config_archive_entry(std::string const& key, std::string const& value)
00142 {
00143 config_archive_entries_[key] = value;
00144 return true;
00145 }
00146
00150 bool clear_config_archive()
00151 {
00152 config_archive_entries_.clear();
00153 return config_archive_entries_.empty();
00154 }
00155
00156 protected:
00164 bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
00165
00166 std::unique_ptr<DataReceiverManager> receiver_ptr_;
00167 std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
00168 std::atomic<bool> stop_requested_;
00169 std::atomic<bool> pause_requested_;
00170 std::atomic<bool> run_is_paused_;
00171 bool verbose_;
00172
00173 fhicl::ParameterSet art_pset_;
00174 std::map<std::string, std::string> config_archive_entries_;
00175
00180 void logMessage_(std::string const& text);
00181 };
00182
00183 #endif