artdaq  v3_04_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 
40  NetMonWrapper(const fhicl::ParameterSet& pset)
41  {
42  ServiceHandle<NetMonTransportService> transport;
43  transport->listen();
44 
45  try {
46  if (metricMan)
47  {
48  metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), app_name);
49  metricMan->do_start();
50  }
51  }
52  catch (...)
53  {
54  artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in NetMonWrapper");
55  }
56  }
57 
62  {
63  ServiceHandle<NetMonTransportService> transport;
64  transport->disconnect();
65  artdaq::Globals::CleanUpGlobals();
66  }
67 
72  void receiveMessage(std::unique_ptr<TBufferFile>& msg);
73 
78  void receiveInitMessage(std::unique_ptr<TBufferFile>& msg);
79  };
80 }
81 
82 #endif /* artdaq_ArtModules_NetMonWrapper_hh */
~NetMonWrapper()
NetMonWrapper Destructor.
This class wraps NetMonTransportService so that it can act as an ArtdaqInput template class...
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.