artdaq  v3_02_00
DataReceiverCore.hh
1 #ifndef artdaq_Application_MPI2_DataReceiverCore_hh
2 #define artdaq_Application_MPI2_DataReceiverCore_hh
3 
4 #include <string>
5 #include <atomic>
6 
7 #include "fhiclcpp/ParameterSet.h"
8 #include "canvas/Persistency/Provenance/RunID.h"
9 
10 #include "artdaq-utilities/Plugins/MetricManager.hh"
11 
12 #include "artdaq/DAQrate/DataReceiverManager.hh"
13 #include "artdaq/Application/StatisticsHelper.hh"
14 
15 namespace artdaq
16 {
17  class DataReceiverCore;
18 }
19 
25 {
26 public:
27 
32 
36  DataReceiverCore(DataReceiverCore const&) = delete;
37 
41  virtual ~DataReceiverCore();
42 
48 
68  virtual bool initialize(fhicl::ParameterSet const& pset) = 0;
69 
75  bool start(art::RunID id);
76 
81  bool stop();
82 
87  bool pause();
88 
93  bool resume();
94 
99  bool shutdown();
100 
106  bool soft_initialize(fhicl::ParameterSet const& pset);
107 
113  bool reinitialize(fhicl::ParameterSet const& pset);
114 
119  bool rollover_subrun(uint64_t eventNum);
120 
132  std::string report(std::string const& which) const;
133 
134 protected:
142  bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
143 
144  std::unique_ptr<DataReceiverManager> receiver_ptr_;
145  std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
146  std::atomic<bool> stop_requested_;
147  std::atomic<bool> pause_requested_;
148  std::atomic<bool> run_is_paused_;
149  bool verbose_;
150 
151  MetricManager metricMan_;
152 
157  void logMessage_(std::string const& text);
158 };
159 
160 #endif /* artdaq_Application_MPI2_DataReceiverCore_hh */
MetricManager metricMan_
MetricManager concrete instance (for Globals.hh::metricMan)
DataReceiverCore()
DataReceiverCore Constructor.
std::shared_ptr< SharedMemoryEventManager > event_store_ptr_
Pointer to the SharedMemoryEventManager.
bool soft_initialize(fhicl::ParameterSet const &pset)
Soft-Initializes the DataReceiverCore. No-Op.
DataReceiverCore implements the state machine for the DataReceiver artdaq application. DataReceiverCore receives Fragment objects from the DataReceiverManager, and sends them to the EventStore.
bool resume()
Resumes the DataReceiverCore.
bool shutdown()
Shuts Down the DataReceiverCore.
bool start(art::RunID id)
Start the DataReceiverCore.
void logMessage_(std::string const &text)
Log a message, setting severity based on verbosity flag.
std::unique_ptr< DataReceiverManager > receiver_ptr_
Pointer to the DataReceiverManager.
bool stop()
Stops the DataReceiverCore.
std::string report(std::string const &which) const
Send a report on a given run-time quantity.
bool verbose_
Whether to log transition messages.
bool pause()
Pauses the DataReceiverCore.
std::atomic< bool > run_is_paused_
Pause has been successfully completed?
DataReceiverCore & operator=(DataReceiverCore const &)=delete
Copy Assignment operator is deleted.
bool rollover_subrun(uint64_t eventNum)
Rollover the subrun after the given event.
bool initializeDataReceiver(fhicl::ParameterSet const &pset, fhicl::ParameterSet const &data_pset, fhicl::ParameterSet const &metric_pset)
Initialize the DataReceiverCore (should be called from initialize() overrides.
std::atomic< bool > pause_requested_
Pause has been requested?
std::atomic< bool > stop_requested_
Stop has been requested?
bool reinitialize(fhicl::ParameterSet const &pset)
Reinitializes the DataReceiverCore.
virtual bool initialize(fhicl::ParameterSet const &pset)=0
Processes the initialize request.