Line data Source code
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 : #include "artdaq/ArtModules/ArtdaqEvent.hh"
11 :
12 : #include <memory>
13 : #include <string>
14 : #include <unordered_map>
15 :
16 : namespace art {
17 : /**
18 : * \brief This class wraps ArtdaqSharedMemoryService so that it can act as an ArtdaqInput
19 : * template class.
20 : *
21 : * JCF, May-27-2016
22 : *
23 : * This class is written with functionality such that it satisfies the
24 : * requirements needed to be a template in the ArtdaqInput class
25 : */
26 : class ShmemWrapper
27 : {
28 : public:
29 : /**
30 : * \brief ShmemWrapper Constructor
31 : * \param ps ParameterSet for ShmemWrapper
32 : */
33 : ShmemWrapper(fhicl::ParameterSet const& ps);
34 :
35 : /**
36 : * \brief ShmemWrapper Destructor
37 : */
38 0 : virtual ~ShmemWrapper() = default;
39 :
40 : /**
41 : * \brief Receive all messsages for an event from ArtdaqSharedMemoryService
42 : * \return A map of Fragment::type_t to a unique_ptr to Fragments containing all Fragments in an event
43 : */
44 : std::shared_ptr<ArtdaqEvent> receiveMessages();
45 :
46 : /**
47 : * \brief Receive an init message from the ArtdaqSharedMemoryService
48 : * \return A list of unique_ptrs to InitFragments
49 : */
50 : artdaq::FragmentPtrs receiveInitMessage();
51 :
52 : private:
53 : ShmemWrapper(ShmemWrapper const&) = delete;
54 : ShmemWrapper(ShmemWrapper&&) = delete;
55 : ShmemWrapper& operator=(ShmemWrapper const&) = delete;
56 : ShmemWrapper& operator=(ShmemWrapper&&) = delete;
57 :
58 : fhicl::ParameterSet data_pset_;
59 : bool init_received_;
60 : double init_timeout_s_;
61 : };
62 : } // namespace art
63 :
64 : #endif /* artdaq_ArtModules_ShmemWrapper_hh */
|