summaryrefslogtreecommitdiff
path: root/lib/eventCounter.cpp
blob: 92383c5f7c2349f1a88c82b75a1e9d9b033580a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "eventCounter.h"
#include <algorithm>

namespace MyGrate {
	void
	EventCounter::tick(mariadb_rpl_event e)
	{
		counters[e]++;
	}
	const EventCounter::Counters &
	EventCounter::getAll() const
	{
		return counters;
	}
	unsigned long
	EventCounter::get(mariadb_rpl_event e) const
	{
		return counters[e];
	}
	bool
	EventCounter::operator>=(const EventCounter & target) const
	{
		for (size_t e {}; e < ENUM_END_EVENT; e++) {
			if (counters[e] < target.counters[e]) {
				return false;
			}
		}
		return true;
	}
}