artdaq  v3_00_03
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 
126  std::string report(std::string const& which) const;
127 
128 protected:
136  bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
137 
138  std::unique_ptr<DataReceiverManager> receiver_ptr_;
139  std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
140  std::atomic<bool> stop_requested_;
141  std::atomic<bool> pause_requested_;
142  std::atomic<bool> run_is_paused_;
143  bool verbose_;
144 
145  MetricManager metricMan_;
146 
151  void logMessage_(std::string const& text);
152 };
153 
154 #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 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?
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.