artdaq  v3_00_01
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 
33  DataReceiverCore(int rank, std::string name);
34 
38  DataReceiverCore(DataReceiverCore const&) = delete;
39 
43  virtual ~DataReceiverCore();
44 
50 
70  virtual bool initialize(fhicl::ParameterSet const& pset) = 0;
71 
77  bool start(art::RunID id);
78 
83  bool stop();
84 
89  bool pause();
90 
95  bool resume();
96 
101  bool shutdown();
102 
108  bool soft_initialize(fhicl::ParameterSet const& pset);
109 
115  bool reinitialize(fhicl::ParameterSet const& pset);
116 
128  std::string report(std::string const& which) const;
129 
130 protected:
138  bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
139 
140  std::string name_;
141 
142  std::unique_ptr<DataReceiverManager> receiver_ptr_;
143  std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
144  std::atomic<bool> stop_requested_;
145  std::atomic<bool> pause_requested_;
146  std::atomic<bool> run_is_paused_;
147  bool verbose_;
148 
149  MetricManager metricMan_;
150 
155  void logMessage_(std::string const& text);
156 };
157 
158 #endif /* artdaq_Application_MPI2_DataReceiverCore_hh */
MetricManager metricMan_
MetricManager concrete instance (for Globals.hh::metricMan)
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.
std::string name_
Name of this DataReceiverCore instance.
bool verbose_
Whether to log verbosely.
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 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?
DataReceiverCore(int rank, std::string name)
DataReceiverCore Constructor.
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.