00001 #ifndef artdaq_ArtModules_NetMonWrapper_hh
00002 #define artdaq_ArtModules_NetMonWrapper_hh
00003
00004
00005 #include "artdaq/ArtModules/NetMonTransportService.h"
00006
00007 #include "art/Framework/Services/Registry/ServiceHandle.h"
00008 #include "artdaq-core/Utilities/ExceptionHandler.hh"
00009 #include "fhiclcpp/fwd.h"
00010
00011 #include <TBufferFile.h>
00012
00013 #include <string>
00014 #include <memory>
00015
00016 namespace art
00017 {
00027 class NetMonWrapper
00028 {
00029 public:
00030
00040 NetMonWrapper(const fhicl::ParameterSet& pset)
00041 {
00042 ServiceHandle<NetMonTransportService> transport;
00043 transport->listen();
00044
00045 try {
00046 if (metricMan)
00047 {
00048 metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), app_name);
00049 metricMan->do_start();
00050 }
00051 }
00052 catch (...)
00053 {
00054 artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in NetMonWrapper");
00055 }
00056 }
00057
00061 ~NetMonWrapper()
00062 {
00063 ServiceHandle<NetMonTransportService> transport;
00064 transport->disconnect();
00065 artdaq::Globals::CleanUpGlobals();
00066 }
00067
00072 void receiveMessage(std::unique_ptr<TBufferFile>& msg);
00073
00078 void receiveInitMessage(std::unique_ptr<TBufferFile>& msg);
00079 };
00080 }
00081
00082 #endif