DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
SubscriptionCriteria.cpp
Go to the documentation of this file.
1//
2// DUNE DAQ modification notice:
3// This file has been modified from the original ATLAS config source for the DUNE DAQ project.
4// Fork baseline commit: 67a24e731 (2022-10-27).
5// Renamed since fork: no.
6//
7
10
11namespace dunedaq {
12namespace conffwk {
13
14void
15ConfigurationSubscriptionCriteria::add(const std::string& class_name)
16{
17 m_classes_subscription.insert(class_name);
18}
19
20void
21ConfigurationSubscriptionCriteria::add(const std::string& class_name, const std::string& object_id)
22{
23 m_objects_subscription[class_name].insert(object_id);
24}
25
26void
28{
29 add(object.class_name(), object.UID());
30}
31
32void
33ConfigurationSubscriptionCriteria::remove(const std::string& class_name)
34{
35 m_classes_subscription.erase(class_name);
36}
37
38void
39ConfigurationSubscriptionCriteria::remove(const std::string& class_name, const std::string& object_id)
40{
41 ObjectMap::iterator i = m_objects_subscription.find(class_name);
42 if (i != m_objects_subscription.end()) {
43 i->second.erase(object_id);
44 if (i->second.empty()) {
46 }
47 }
48}
49
50void
52{
53 remove(object.class_name(), object.UID());
54}
55
56std::ostream&
57operator<<(std::ostream& s, const ConfigurationSubscriptionCriteria& criteria)
58{
59 s << "Subscription criteria:\n";
60
61 // print out classes subscription
62 s << " classes subscription: ";
63
64 if (criteria.get_classes_subscription().empty()) {
65 s << "(null)\n";
66 } else {
67 s << std::endl;
68 for (const auto& i : criteria.get_classes_subscription()) {
69 s << " \"" << i << "\"\n";
70 }
71 }
72
73 // print out objects subscription
74 s << " objects subscription: ";
75
76 if (criteria.get_objects_subscription().empty()) {
77 s << "(null)\n";
78 } else {
79 s << std::endl;
80 for (const auto& i : criteria.get_objects_subscription()) {
81 s << " objects of class \"" << i.first << "\":\n";
82 for (const auto& j : i.second) {
83 s << " \"" << j << "\":\n";
84 }
85 }
86 }
87
88 return s;
89}
90} // namespace conffwk
91} // 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:51
std::ostream & operator<<(std::ostream &, const ConfigurationChange &)
The DUNE-DAQ namespace.