DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
QueueRegistry.cpp
Go to the documentation of this file.
1
12
13#include <map>
14#include <memory>
15#include <set>
16#include <string>
17#include <vector>
18
19namespace dunedaq::iomanager {
20
21std::unique_ptr<QueueRegistry> QueueRegistry::s_instance = nullptr;
22
23QueueRegistry&
25{
26 if (!s_instance) {
27 s_instance.reset(new QueueRegistry());
28 }
29 return *s_instance;
30}
31
32void
33QueueRegistry::configure(const std::vector<const confmodel::Queue*>& configs, opmonlib::OpMonManager& mgr)
34{
35 if (m_configured) {
36 throw QueueRegistryConfigured(ERS_HERE);
37 }
38
39 m_queue_configs = configs;
40
41 mgr.register_node("queues", m_opmon_link);
42
43 m_configured = true;
44}
45
46bool
47QueueRegistry::has_queue(const std::string& uid, const std::string& data_type) const
48{
49 for (auto& config : m_queue_configs) {
50 if (config->UID() == uid && config->get_data_type() == data_type) {
51 return true;
52 }
53 }
54
55 return false;
56}
57
58std::set<std::string>
59QueueRegistry::get_datatypes(const std::string& uid) const
60{
61 std::set<std::string> output;
62
63 for (auto& config : m_queue_configs) {
64 if (config->UID() == uid) {
65 output.insert(config->get_data_type());
66 }
67 }
68
69 return output;
70}
71
72} // namespace dunedaq::iomanager
#define ERS_HERE
static QueueRegistry & get()
Get a handle to the QueueRegistry.
static std::unique_ptr< QueueRegistry > s_instance
void configure(const std::vector< const confmodel::Queue * > &configs, opmonlib::OpMonManager &mgr)
Configure the QueueRegistry.
std::set< std::string > get_datatypes(std::string const &uid) const
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
void register_node(ElementId name, NewNodePtr)