Line data Source code
1 : #ifndef artdaq_ArtModules_ArtdaqSharedMemoryServiceInterface_h
2 : #define artdaq_ArtModules_ArtdaqSharedMemoryServiceInterface_h
3 :
4 : #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
5 : #include "artdaq-core/Data/RawEvent.hh"
6 : #include "artdaq/ArtModules/ArtdaqEvent.hh"
7 : #include "fhiclcpp/types/Atom.h"
8 :
9 : /**
10 : * \brief Interface for ArtdaqSharedMemoryService. This interface is declared to art as part of the required registration of an art Service
11 : */
12 : class ArtdaqSharedMemoryServiceInterface
13 : {
14 : public:
15 0 : ArtdaqSharedMemoryServiceInterface() = default;
16 :
17 : /**
18 : * \brief Default virtual destructor
19 : */
20 0 : virtual ~ArtdaqSharedMemoryServiceInterface() = default;
21 :
22 : /**
23 : * \brief Receive an event from the shared memory
24 : * \param broadcast Whether to only attempt to receive a broadcast (broadcasts are always preferentially received over data)
25 : * \return Event Struct received from shared memory
26 : */
27 : virtual std::shared_ptr<ArtdaqEvent> ReceiveEvent(bool broadcast) = 0;
28 :
29 : /**
30 : * \brief Get the number of events which are ready to be read
31 : * \return The number of events which can be read
32 : */
33 : virtual size_t GetQueueSize() = 0;
34 :
35 : /**
36 : * \brief Get the maximum number of events which can be stored in the shared memory
37 : * \return The maximum number of events which can be stored in the shared memory
38 : */
39 : virtual size_t GetQueueCapacity() = 0;
40 :
41 : /**
42 : * \brief Get the ID of this art process
43 : * \return The ID of this art process (from shm->GetMyId())
44 : */
45 : virtual size_t GetMyId() = 0;
46 :
47 : private:
48 : ArtdaqSharedMemoryServiceInterface(ArtdaqSharedMemoryServiceInterface const&) = delete;
49 : ArtdaqSharedMemoryServiceInterface(ArtdaqSharedMemoryServiceInterface&&) = delete;
50 : ArtdaqSharedMemoryServiceInterface& operator=(ArtdaqSharedMemoryServiceInterface const&) = delete;
51 : ArtdaqSharedMemoryServiceInterface& operator=(ArtdaqSharedMemoryServiceInterface&&) = delete;
52 : };
53 :
54 0 : DECLARE_ART_SERVICE_INTERFACE(ArtdaqSharedMemoryServiceInterface, LEGACY)
55 :
56 : #endif /* artdaq_ArtModules_ArtdaqSharedMemoryServiceInterface_h */
57 :
58 : // Local Variables:
59 : // mode: c++
60 : // End:
|