artdaq  v3_12_02
ShmemWrapper.hh
1 #ifndef artdaq_ArtModules_ShmemWrapper_hh
2 #define artdaq_ArtModules_ShmemWrapper_hh
3 
4 #include "TRACE/tracemf.h" // Pre-empt TRACE/trace.h from Fragment.hh.
5 #include "artdaq-core/Data/Fragment.hh"
6 
7 #include "fhiclcpp/ParameterSet.h"
8 
9 #include "artdaq-core/Data/RawEvent.hh"
10 
11 #include <memory>
12 #include <string>
13 #include <unordered_map>
14 
15 namespace art {
26 {
27 public:
32  ShmemWrapper(fhicl::ParameterSet const& ps);
33 
37  virtual ~ShmemWrapper() = default;
38 
43  artdaq::FragmentPtrs receiveMessage();
48  std::unordered_map<artdaq::Fragment::type_t, std::unique_ptr<artdaq::Fragments>> receiveMessages();
49 
54  artdaq::FragmentPtrs receiveInitMessage();
55 
60  std::shared_ptr<artdaq::detail::RawEventHeader> getEventHeader() { return hdr_ptr_; }
61 
62 private:
63  ShmemWrapper(ShmemWrapper const&) = delete;
64  ShmemWrapper(ShmemWrapper&&) = delete;
65  ShmemWrapper& operator=(ShmemWrapper const&) = delete;
66  ShmemWrapper& operator=(ShmemWrapper&&) = delete;
67 
68  fhicl::ParameterSet data_pset_;
69  bool init_received_;
70  double init_timeout_s_;
71  std::shared_ptr<artdaq::detail::RawEventHeader> hdr_ptr_;
72 };
73 } // namespace art
74 
75 #endif /* artdaq_ArtModules_ShmemWrapper_hh */
std::unordered_map< artdaq::Fragment::type_t, std::unique_ptr< artdaq::Fragments > > receiveMessages()
Receive all messsages for an event from ArtdaqSharedMemoryService.
Definition: ShmemWrapper.cc:81
artdaq::FragmentPtrs receiveMessage()
Receive a message from the ArtdaqSharedMemoryService.
Definition: ShmemWrapper.cc:17
ShmemWrapper(fhicl::ParameterSet const &ps)
ShmemWrapper Constructor.
Definition: ShmemWrapper.cc:10
virtual ~ShmemWrapper()=default
ShmemWrapper Destructor.
This class wraps ArtdaqSharedMemoryService so that it can act as an ArtdaqInput template class...
Definition: ShmemWrapper.hh:25
artdaq::FragmentPtrs receiveInitMessage()
Receive an init message from the ArtdaqSharedMemoryService.
std::shared_ptr< artdaq::detail::RawEventHeader > getEventHeader()
Get a pointer to the last received RawEventHeader.
Definition: ShmemWrapper.hh:60