artdaq  v3_12_02
DataReceiverCore.hh
1 #ifndef artdaq_Application_MPI2_DataReceiverCore_hh
2 #define artdaq_Application_MPI2_DataReceiverCore_hh
3 
4 #include "canvas/Persistency/Provenance/RunID.h"
5 #include "fhiclcpp/ParameterSet.h"
6 
7 #include "artdaq/DAQrate/DataReceiverManager.hh"
8 #include "artdaq/DAQrate/SharedMemoryEventManager.hh"
9 
10 #include <atomic>
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 namespace artdaq {
16 class DataReceiverCore;
17 }
18 
24 {
25 public:
30 
34  DataReceiverCore(DataReceiverCore const&) = delete;
35 
39  virtual ~DataReceiverCore();
40 
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 
121  bool rollover_subrun(uint64_t boundary, uint32_t subrun);
122 
134  std::string report(std::string const& which) const;
135 
142  bool add_config_archive_entry(std::string const& key, std::string const& value)
143  {
144  config_archive_entries_[key] = value;
145  return true;
146  }
147 
153  {
154  config_archive_entries_.clear();
155  return config_archive_entries_.empty();
156  }
157 
158 protected:
166  bool initializeDataReceiver(fhicl::ParameterSet const& pset, fhicl::ParameterSet const& data_pset, fhicl::ParameterSet const& metric_pset);
167 
168  std::unique_ptr<DataReceiverManager> receiver_ptr_;
169  std::shared_ptr<SharedMemoryEventManager> event_store_ptr_;
170  std::atomic<bool> stop_requested_;
171  std::atomic<bool> pause_requested_;
172  std::atomic<bool> run_is_paused_;
173  bool verbose_;
174 
175  fhicl::ParameterSet art_pset_;
176  std::map<std::string, std::string> config_archive_entries_;
177 };
178 
179 #endif /* artdaq_Application_MPI2_DataReceiverCore_hh */
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.
bool rollover_subrun(uint64_t boundary, uint32_t subrun)
Rollover the subrun after the given event.
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.
fhicl::ParameterSet art_pset_
ParameterSet sent to art process.
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::map< std::string, std::string > config_archive_entries_
Additional strings to archive as part of the art configuration.
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 add_config_archive_entry(std::string const &key, std::string const &value)
Add the specified key and value to the configuration archive list.
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?
bool clear_config_archive()
Clear the configuration archive list.
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.