summaryrefslogtreecommitdiff
path: root/lib/eventCounter.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-22 13:09:25 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-22 13:09:25 +0100
commitde50cd15f12216760bb746ec8936fc1501113425 (patch)
tree5046e4d35693de2e83b12881bc7cd7cf1a05e2d0 /lib/eventCounter.h
parentEnable numeric conversion warning and fix the fallout (diff)
downloadmygrate-de50cd15f12216760bb746ec8936fc1501113425.tar.bz2
mygrate-de50cd15f12216760bb746ec8936fc1501113425.tar.xz
mygrate-de50cd15f12216760bb746ec8936fc1501113425.zip
Add EventCounter class
Diffstat (limited to 'lib/eventCounter.h')
-rw-r--r--lib/eventCounter.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/eventCounter.h b/lib/eventCounter.h
new file mode 100644
index 0000000..522310a
--- /dev/null
+++ b/lib/eventCounter.h
@@ -0,0 +1,22 @@
+#ifndef MYGRATE_EVENTCOUNTER_H
+#define MYGRATE_EVENTCOUNTER_H
+
+#include "mariadb_repl.h"
+#include <array>
+
+namespace MyGrate {
+ class EventCounter {
+ public:
+ using Counters = std::array<unsigned long, ENUM_END_EVENT>;
+
+ void tick(mariadb_rpl_event);
+ const Counters & getAll() const;
+ unsigned long get(mariadb_rpl_event) const;
+ bool operator>=(const EventCounter &) const;
+
+ protected:
+ Counters counters {};
+ };
+}
+
+#endif