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 try {
00043 if (metricMan)
00044 {
00045 metricMan->initialize(pset.get<fhicl::ParameterSet>("metrics", fhicl::ParameterSet()), "artdaqart");
00046 metricMan->do_start();
00047 }
00048 }
00049 catch (...)
00050 {
00051 artdaq::ExceptionHandler(artdaq::ExceptionHandlerRethrow::no, "Error loading metrics in NetMonWrapper");
00052 }
00053
00054 ServiceHandle<NetMonTransportService> transport;
00055 transport->listen();
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