DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
IOManager.hpp
Go to the documentation of this file.
1
9#ifndef IOMANAGER_INCLUDE_IOMANAGER_IOMANAGER_HPP_
10#define IOMANAGER_INCLUDE_IOMANAGER_IOMANAGER_HPP_
11
14#include "iomanager/Sender.hpp"
16
19#include "confmodel/Queue.hpp"
20
21#include <chrono>
22#include <functional>
23#include <map>
24#include <memory>
25#include <string>
26
27namespace dunedaq {
28
29namespace iomanager {
30
37{
38
39public:
40 static std::shared_ptr<IOManager> get()
41 {
42 if (!s_instance)
43 s_instance = std::shared_ptr<IOManager>(new IOManager());
44
45 return s_instance;
46 }
47
48 IOManager(const IOManager&) = delete;
49 IOManager& operator=(const IOManager&) = delete;
50 IOManager(IOManager&&) = delete;
52
53 void configure(std::string session,
54 std::vector<const confmodel::Queue*> queues,
55 std::vector<const confmodel::NetworkConnection*> connections,
56 const confmodel::ConnectivityService* connection_service,
58
59 void reset();
60 void shutdown();
61
62 template<typename Datatype>
63 std::shared_ptr<SenderConcept<Datatype>> get_sender(ConnectionId id);
64
65 template<typename Datatype>
66 std::shared_ptr<SenderConcept<Datatype>> get_sender(std::string const& uid);
67
68 template<typename Datatype>
69 std::shared_ptr<ReceiverConcept<Datatype>> get_receiver(ConnectionId id);
70
71 template<typename Datatype>
72 std::shared_ptr<ReceiverConcept<Datatype>> get_receiver(std::string const& uid);
73 template<typename Datatype>
74 std::shared_ptr<ReceiverConcept<Datatype>> get_receiver(std::string const& uid, std::string const& tag);
75
76 template<typename Datatype>
77 void add_callback(ConnectionId const& id, std::function<void(Datatype&)> callback);
78
79 template<typename Datatype>
80 void add_callback(std::string const& uid, std::function<void(Datatype&)> callback);
81
82 template<typename Datatype>
83 void add_callback(std::string const& uid, std::string const& tag, std::function<void(Datatype&)> callback);
84
85 template<typename Datatype>
86 void remove_callback(ConnectionId const& id);
87
88 template<typename Datatype>
89 void remove_callback(std::string const& uid);
90 template<typename Datatype>
91 void remove_callback(std::string const& uid, std::string const& tag);
92
93 std::set<std::string> get_datatypes(std::string const& uid);
94
95private:
97
98 using SenderMap = std::map<ConnectionId, std::shared_ptr<Sender>>;
99 using ReceiverMap = std::map<ConnectionId, std::shared_ptr<Receiver>>;
102 std::string m_session;
103
104 static std::shared_ptr<IOManager> s_instance;
105};
106
107} // namespace iomanager
108
109} // namespace dunedaq
110
111#include "detail/IOManager.hxx"
112
113#endif // IOMANAGER_INCLUDE_IOMANAGER_IOMANAGER_HPP_
static std::shared_ptr< IOManager > get()
Definition IOManager.hpp:40
static std::shared_ptr< IOManager > s_instance
IOManager(IOManager &&)=delete
IOManager is not move-constructible.
void configure(std::string session, std::vector< const confmodel::Queue * > queues, std::vector< const confmodel::NetworkConnection * > connections, const confmodel::ConnectivityService *connection_service, opmonlib::OpMonManager &)
Definition IOManager.cpp:16
void add_callback(ConnectionId const &id, std::function< void(Datatype &)> callback)
Definition IOManager.hxx:24
std::map< ConnectionId, std::shared_ptr< Receiver > > ReceiverMap
Definition IOManager.hpp:99
std::set< std::string > get_datatypes(std::string const &uid)
Definition IOManager.cpp:48
IOManager(const IOManager &)=delete
IOManager is not copy-constructible.
std::shared_ptr< SenderConcept< Datatype > > get_sender(ConnectionId id)
Definition IOManager.hxx:96
void remove_callback(ConnectionId const &id)
std::map< ConnectionId, std::shared_ptr< Sender > > SenderMap
Definition IOManager.hpp:98
IOManager & operator=(const IOManager &)=delete
IOManager is not copy-assignable.
std::shared_ptr< ReceiverConcept< Datatype > > get_receiver(ConnectionId id)
Definition IOManager.hxx:56
IOManager & operator=(IOManager &&)=delete
IOManager is not move-assignable.
Including Qt Headers.