artdaq  v3_06_00
NetMonWrapper.hh
1 #ifndef artdaq_ArtModules_NetMonWrapper_hh
2 #define artdaq_ArtModules_NetMonWrapper_hh
3 
4 
5 #include "artdaq/ArtModules/NetMonTransportService.h"
6 
7 #include "art/Framework/Services/Registry/ServiceHandle.h"
8 #include "artdaq-core/Utilities/ExceptionHandler.hh"
9 #include "fhiclcpp/fwd.h"
10 
11 #include <TBufferFile.h>
12 
13 #include <string>
14 #include <memory>
15 
16 namespace art
17 {
28  {
29  public:
30 
35  NetMonWrapper(const fhicl::ParameterSet& pset)
36  {
37  ServiceHandle<NetMonTransportService> transport;
38  transport->listen();
39 
40  try {
41  if (metricMan)
42  {
43  metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), app_name);
44  metricMan->do_start();
45  }
46  }
47  catch (...)
48  {
49  artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in NetMonWrapper");
50  }
51  }
52 
57  {
58  ServiceHandle<NetMonTransportService> transport;
59  transport->disconnect();
61  }
62 
67  void receiveMessage(std::unique_ptr<TBufferFile>& msg);
68 
73  void receiveInitMessage(std::unique_ptr<TBufferFile>& msg);
74  };
75 }
76 
77 #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.