Line data Source code
1 :
2 : #include "opmonlib/BackendOpMonFacility.hpp"
3 :
4 : using namespace dunedaq::opmonlib;
5 :
6 : void
7 106 : BackendOpMonFacility::publish(opmon::OpMonEntry&& e) const
8 : {
9 :
10 106 : std::lock_guard<std::mutex> lk(m_mutex);
11 106 : m_list.push_back(e);
12 106 : }
13 :
14 : BackendOpMonFacility::data_t
15 21 : BackendOpMonFacility::get_entries(std::regex measurement_filter)
16 : {
17 :
18 21 : std::unique_lock<std::mutex> lk(m_mutex);
19 21 : data_t ret;
20 21 : m_list.swap(ret);
21 21 : lk.unlock();
22 :
23 21 : std::smatch values;
24 21 : auto it = ret.begin();
25 125 : while (it != ret.end()) {
26 104 : if (!std::regex_match(it->measurement(), values, measurement_filter)) {
27 81 : it = ret.erase(it);
28 : } else {
29 23 : ++it;
30 : }
31 : }
32 :
33 21 : return ret;
34 21 : }
|