2 #include "ErrorHandler/MessageAnalyzer/ma_participants.h"
7 using namespace novadaq::errorhandler;
12 void ma_participants::add_group(std::string
const& group)
14 groups_t::const_iterator it = groups.find(group);
16 if (it != groups.end())
17 throw std::runtime_error(group +
" already exists while creating new group");
20 groups.insert(std::make_pair(group, apps));
23 void ma_participants::add_group(std::string
const& group,
size_t size)
25 groups_t::const_iterator it = groups.find(group);
27 if (it != groups.end())
28 throw std::runtime_error(group +
" already exists while creating new group");
33 for (
size_t i = 0; i < size; ++i)
37 apps.insert(ss.str());
38 all_apps.insert(ss.str());
41 groups.insert(std::make_pair(group, apps));
47 void ma_participants::add_participant(std::string
const& group, std::string
const& app)
49 groups_t::iterator it = groups.find(group);
51 if (it == groups.end())
52 throw std::runtime_error(group +
" does not exist while inserting participants");
54 it->second.insert(app);
58 void ma_participants::add_participant(std::string
const& app)
60 ungrouped_apps.insert(app);
67 size_t ma_participants::
68 get_group_participant_count(std::string
const& group)
const
70 groups_t::const_iterator it = groups.find(group);
72 if (it == groups.end())
73 throw std::runtime_error(group +
" does not exist while getting participant count");
75 return it->second.size();
78 size_t ma_participants::
79 get_participant_count()
const
81 return all_apps.size();
86 void ma_participants::reset()
88 ungrouped_apps.clear();