DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
QueueRegistry.hpp
Go to the documentation of this file.
1
11#ifndef IOMANAGER_INCLUDE_IOMANAGER_QUEUEREGISTRY_HPP_
12#define IOMANAGER_INCLUDE_IOMANAGER_QUEUEREGISTRY_HPP_
13
17
18#include "confmodel/Queue.hpp"
20
21#include "ers/Issue.hpp"
22
23#include <map>
24#include <memory>
25#include <string>
26
27namespace dunedaq {
28namespace iomanager {
29
35{
36public:
40 ~QueueRegistry() = default;
41
46 static QueueRegistry& get();
47
54 template<typename T>
55 std::shared_ptr<Queue<T>> get_queue(const std::string& name);
56
61 void configure(const std::vector<const confmodel::Queue*>& configs, opmonlib::OpMonManager &);
62
63 // ONLY TO BE USED FOR TESTING!
64 static void reset() { s_instance.reset(nullptr); }
65 void shutdown() { m_queue_registry.clear(); }
66
67 bool has_queue(std::string const& uid, std::string const& data_type) const;
68
69 std::set<std::string> get_datatypes(std::string const& uid) const;
70
71private:
73 {
75 const std::type_info* m_type;
76 std::shared_ptr<QueueBase> m_instance;
77 };
78
79 QueueRegistry() = default;
80
81 template<typename T>
82 std::shared_ptr<QueueBase> create_queue(const confmodel::Queue* config);
83
84 std::map<std::string, QueueEntry> m_queue_registry;
85 std::vector<const confmodel::Queue*> m_queue_configs;
86 std::shared_ptr<opmonlib::OpMonLink> m_opmon_link{ std::make_shared<opmonlib::OpMonLink>() };
87
88 bool m_configured{ false };
89
90 static std::unique_ptr<QueueRegistry> s_instance;
91
92 QueueRegistry(const QueueRegistry&) = delete;
96};
97
98} // namespace iomanager
99
100} // namespace dunedaq
101
103
104#endif // IOMANAGER_INCLUDE_IOMANAGER_QUEUEREGISTRY_HPP_
The QueueRegistry class manages all Queue instances and gives out handles to the Queues upon request.
std::map< std::string, QueueEntry > m_queue_registry
QueueRegistry(QueueRegistry &&)=delete
static QueueRegistry & get()
Get a handle to the QueueRegistry.
static std::unique_ptr< QueueRegistry > s_instance
~QueueRegistry()=default
QueueRegistry destructor.
QueueRegistry(const QueueRegistry &)=delete
std::shared_ptr< QueueBase > create_queue(const confmodel::Queue *config)
std::set< std::string > get_datatypes(std::string const &uid) const
QueueRegistry & operator=(QueueRegistry &&)=delete
void configure(const std::vector< const confmodel::Queue * > &configs, opmonlib::OpMonManager &)
Configure the QueueRegistry.
std::vector< const confmodel::Queue * > m_queue_configs
bool has_queue(std::string const &uid, std::string const &data_type) const
std::shared_ptr< opmonlib::OpMonLink > m_opmon_link
std::shared_ptr< Queue< T > > get_queue(const std::string &name)
Get a handle to a Queue.
QueueRegistry & operator=(const QueueRegistry &)=delete
Including Qt Headers.