artdaq  v3_06_01
NetMonWrapper.hh
1 #ifndef artdaq_ArtModules_NetMonWrapper_hh
2 #define artdaq_ArtModules_NetMonWrapper_hh
3 
4 #include "artdaq/ArtModules/NetMonTransportService.h"
5 
6 #include "art/Framework/Services/Registry/ServiceHandle.h"
7 #include "artdaq-core/Utilities/ExceptionHandler.hh"
8 #include "fhiclcpp/fwd.h"
9 
10 #include <TBufferFile.h>
11 
12 #include <memory>
13 #include <string>
14 
15 namespace art {
26 {
27 public:
32  NetMonWrapper(const fhicl::ParameterSet& pset)
33  {
34  ServiceHandle<NetMonTransportService> transport;
35  transport->listen();
36 
37  try
38  {
39  if (metricMan)
40  {
41  metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), app_name);
42  metricMan->do_start();
43  }
44  }
45  catch (...)
46  {
47  artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in NetMonWrapper");
48  }
49  }
50 
55  {
56  ServiceHandle<NetMonTransportService> transport;
57  transport->disconnect();
59  }
60 
65  void receiveMessage(std::unique_ptr<TBufferFile>& msg);
66 
71  void receiveInitMessage(std::unique_ptr<TBufferFile>& msg);
72 };
73 } // namespace art
74 
75 #endif /* artdaq_ArtModules_NetMonWrapper_hh */
~NetMonWrapper()
NetMonWrapper Destructor.
This class wraps NetMonTransportService so that it can act as an ArtdaqInput template class...
static void CleanUpGlobals()
Clean up statically-allocated Manager class instances.
Definition: Globals.hh:150
void receiveMessage(std::unique_ptr< TBufferFile > &msg)
Receive a message from the NetMonTransportService.
Definition: NetMonWrapper.cc:7
NetMonWrapper(const fhicl::ParameterSet &pset)
NetMonWrapper Constructor.
void receiveInitMessage(std::unique_ptr< TBufferFile > &msg)
Receive an init message from the NetMonTransportService.