DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
SubscriptionCriteria.cpp
Go to the documentation of this file.
3
4namespace dunedaq {
5namespace conffwk {
6
7void
8ConfigurationSubscriptionCriteria::add(const std::string& class_name)
9{
10 m_classes_subscription.insert(class_name);
11}
12
13void
14ConfigurationSubscriptionCriteria::add(const std::string& class_name, const std::string& object_id)
15{
16 m_objects_subscription[class_name].insert(object_id);
17}
18
19void
21{
22 add(object.class_name(), object.UID());
23}
24
25void
26ConfigurationSubscriptionCriteria::remove(const std::string& class_name)
27{
28 m_classes_subscription.erase(class_name);
29}
30
31void
32ConfigurationSubscriptionCriteria::remove(const std::string& class_name, const std::string& object_id)
33{
34 ObjectMap::iterator i = m_objects_subscription.find(class_name);
35 if (i != m_objects_subscription.end())
36 {
37 i->second.erase(object_id);
38 if (i->second.empty())
39 {
41 }
42 }
43}
44
45void
47{
48 remove(object.class_name(), object.UID());
49}
50
51std::ostream&
52operator<<(std::ostream& s, const ConfigurationSubscriptionCriteria& criteria)
53{
54 s << "Subscription criteria:\n";
55
56 // print out classes subscription
57 s << " classes subscription: ";
58
59 if (criteria.get_classes_subscription().empty())
60 {
61 s << "(null)\n";
62 }
63 else
64 {
65 s << std::endl;
66 for (const auto& i : criteria.get_classes_subscription())
67 {
68 s << " \"" << i << "\"\n";
69 }
70 }
71
72 // print out objects subscription
73 s << " objects subscription: ";
74
75 if (criteria.get_objects_subscription().empty())
76 {
77 s << "(null)\n";
78 }
79 else
80 {
81 s << std::endl;
82 for (const auto& i : criteria.get_objects_subscription())
83 {
84 s << " objects of class \"" << i.first << "\":\n";
85 for (const auto& j : i.second)
86 {
87 s << " \"" << j << "\":\n";
88 }
89 }
90 }
91
92 return s;
93}
94} // namespace conffwk
95} // namespace dunedaq
void add(const std::string &class_name)
Add subscribtion on class changes.
const std::set< std::string > & get_classes_subscription() const
void remove(const std::string &class_name)
Remove subscribtion on class changes.
The base class for any generated DAL object.
Definition DalObject.hpp:45
std::ostream & operator<<(std::ostream &, const ConfigurationChange &)
Including Qt Headers.