Line data Source code
1 : #ifndef artdaq_ArtModules_ArtdaqGlobalsService_h
2 : #define artdaq_ArtModules_ArtdaqGlobalsService_h
3 :
4 : #include "art/Framework/Services/Registry/ServiceMacros.h"
5 : #include "artdaq-core/Data/RawEvent.hh"
6 : #include "artdaq/ArtModules/ArtdaqSharedMemoryServiceInterface.h"
7 : #include "fhiclcpp/types/Atom.h"
8 :
9 : // ----------------------------------------------------------------------
10 :
11 : /**
12 : * \brief ArtdaqGlobalsService extends ArtdaqSharedMemoryServiceInterface.
13 : * It manages the artdaq Global varaibles my_rank and app_name, and initializes MetricManager.
14 : * Users should retrieve a ServiceHandle to this class before using artdaq Globals to ensure the correct values are used.
15 : */
16 : class ArtdaqGlobalsService : public ArtdaqSharedMemoryServiceInterface
17 : {
18 : public:
19 : /// <summary>
20 : /// Allowed Configuration parameters of ArtdaqGlobalsService. May be used for configuration validation
21 : /// </summary>
22 : struct Config
23 : {
24 : };
25 : /// Used for ParameterSet validation (if desired)
26 : using Parameters = fhicl::WrappedTable<Config>;
27 :
28 : /**
29 : * \brief ArtdaqGlobalsService Destructor. Calls disconnect().
30 : */
31 : virtual ~ArtdaqGlobalsService();
32 :
33 : /**
34 : * \brief ArtdaqGlobalsService Constructor
35 : * \param pset ParameterSet used to configure ArtdaqGlobalsService. See ArtdaqGlobalsService::Config
36 : */
37 : ArtdaqGlobalsService(fhicl::ParameterSet const& pset, art::ActivityRegistry&);
38 :
39 : /**
40 : * \brief Pretend to receive an event from the shared memory
41 : * \return Map of Fragment types retrieved from shared memory
42 : */
43 0 : std::shared_ptr<ArtdaqEvent> ReceiveEvent(bool) override
44 : {
45 0 : return nullptr;
46 : }
47 :
48 : /**
49 : * \brief Get the number of events which are ready to be read (0)
50 : * \return The number of events which can be read (0)
51 : */
52 0 : size_t GetQueueSize() override { return 0; }
53 :
54 : /**
55 : * \brief Get the maximum number of events which can be stored in the shared memory (0)
56 : * \return The maximum number of events which can be stored in the shared memory (0)
57 : */
58 0 : size_t GetQueueCapacity() override { return 0; }
59 :
60 : /**
61 : * \brief Get the ID of this art process. Always 0 since ArtdaqGlobalsService does not connect to shared memory
62 : * \return 0
63 : */
64 0 : size_t GetMyId() override { return 0; }
65 :
66 : private:
67 : ArtdaqGlobalsService(ArtdaqGlobalsService const&) = delete;
68 : ArtdaqGlobalsService(ArtdaqGlobalsService&&) = delete;
69 : ArtdaqGlobalsService& operator=(ArtdaqGlobalsService const&) = delete;
70 : ArtdaqGlobalsService& operator=(ArtdaqGlobalsService&&) = delete;
71 : };
72 :
73 0 : DECLARE_ART_SERVICE_INTERFACE_IMPL(ArtdaqGlobalsService, ArtdaqSharedMemoryServiceInterface, LEGACY)
74 :
75 : #endif /* artdaq_ArtModules_ArtdaqGlobalsService_h */
76 :
77 : // Local Variables:
78 : // mode: c++
79 : // End:
|