$treeview $search $mathjax $extrastylesheet
artdaq
v3_04_01
$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 }; 00035 using Parameters = fhicl::WrappedTable<Config>; 00036 00037 00041 virtual ~NetMonTransportService(); 00042 00047 NetMonTransportService(fhicl::ParameterSet const& pset, art::ActivityRegistry&); 00048 00054 void connect() override; 00055 00061 void disconnect() override; 00062 00066 void listen() override; 00067 00074 void sendMessage(uint64_t sequenceId, uint8_t messageType, TBufferFile& msg) override; 00075 00080 void receiveMessage(TBufferFile*& msg) override; 00081 00082 void receiveInitMessage(TBufferFile*& msg) override; 00083 00088 size_t dataReceiverCount() const { return sender_ptr_->destinationCount(); } 00089 private: 00090 fhicl::ParameterSet data_pset_; 00091 bool init_received_; 00092 double init_timeout_s_; 00093 00094 std::unique_ptr<artdaq::DataSenderManager> sender_ptr_; 00095 std::unique_ptr<artdaq::SharedMemoryEventReceiver> incoming_events_; 00096 std::unique_ptr<std::vector<artdaq::Fragment>> recvd_fragments_; 00097 00098 void setupEventReceiver_(); 00099 }; 00100 00101 DECLARE_ART_SERVICE_INTERFACE_IMPL(NetMonTransportService, NetMonTransportServiceInterface, LEGACY) 00102 #endif /* artdaq_ArtModules_NetMonTransportService_h */ 00103 00104 // Local Variables: 00105 // mode: c++ 00106 // End: