$treeview $search $mathjax $extrastylesheet
artdaq
v3_04_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef artdaq_ArtModules_NetMonTransportService_h 00002 #define artdaq_ArtModules_NetMonTransportService_h 00003 00004 #include "art/Framework/Services/Registry/ServiceMacros.h" 00005 00006 #include "artdaq/ArtModules/NetMonTransportServiceInterface.h" 00007 #include "artdaq/DAQrate/DataSenderManager.hh" 00008 #include "artdaq-core/Core/SharedMemoryEventReceiver.hh" 00009 00010 // ---------------------------------------------------------------------- 00011 00016 class NetMonTransportService : public NetMonTransportServiceInterface 00017 { 00018 public: 00022 struct Config 00023 { 00025 fhicl::Atom<uint32_t> shared_memory_key{ fhicl::Name{"shared_memory_key"},fhicl::Comment{"Key to use when connecting to shared memory. Will default to 0xBEE70000 + getppid()."},0xBEE70000 }; 00027 fhicl::Atom<uint32_t> broadcast_shared_memory_key{ fhicl::Name{ "broadcast_shared_memory_key" },fhicl::Comment{ "Key to use when connecting to broadcast shared memory. Will default to 0xCEE70000 + getppid()."},0xCEE70000 }; 00029 fhicl::Atom<int> rank{ fhicl::Name{"rank"}, fhicl::Comment{"Rank of this artdaq application. Used for data transfers"} }; 00031 fhicl::Atom<double> init_fragment_timeout{ fhicl::Name{"init_fragment_timeout_seconds"}, fhicl::Comment{"Amount of time to wait, in seconds, for init Fragment to arrive"}, 1.0 }; 00032 fhicl::TableFragment<artdaq::DataSenderManager::Config> dataSenderConfig; 00033 }; 00034 using Parameters = fhicl::WrappedTable<Config>; 00035 00036 00040 virtual ~NetMonTransportService(); 00041 00046 NetMonTransportService(fhicl::ParameterSet const& pset, art::ActivityRegistry&); 00047 00053 void connect() override; 00054 00060 void disconnect() override; 00061 00065 void listen() override; 00066 00073 void sendMessage(uint64_t sequenceId, uint8_t messageType, TBufferFile& msg) override; 00074 00079 void receiveMessage(TBufferFile*& msg) override; 00080 00081 void receiveInitMessage(TBufferFile*& msg) override; 00082 00087 size_t dataReceiverCount() const { return sender_ptr_->destinationCount(); } 00088 private: 00089 fhicl::ParameterSet data_pset_; 00090 bool init_received_; 00091 double init_timeout_s_; 00092 00093 std::unique_ptr<artdaq::DataSenderManager> sender_ptr_; 00094 std::unique_ptr<artdaq::SharedMemoryEventReceiver> incoming_events_; 00095 std::unique_ptr<std::vector<artdaq::Fragment>> recvd_fragments_; 00096 00097 void setupEventReceiver_(); 00098 }; 00099 00100 DECLARE_ART_SERVICE_INTERFACE_IMPL(NetMonTransportService, NetMonTransportServiceInterface, LEGACY) 00101 #endif /* artdaq_ArtModules_NetMonTransportService_h */ 00102 00103 // Local Variables: 00104 // mode: c++ 00105 // End: