diff options
author | Aki <please@ignore.pl> | 2022-12-16 01:40:09 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-16 01:40:09 +0100 |
commit | 1482c7dbe3dd7de66ccffee9596dd42e12698b04 (patch) | |
tree | 35f087dd07fcb2a35b66e2d5d03878acc9fcccb9 /stats/include | |
parent | d599de1ffc38f8c7f17b454fdf6eb3aaf320c89e (diff) | |
download | kurator-1482c7dbe3dd7de66ccffee9596dd42e12698b04.zip kurator-1482c7dbe3dd7de66ccffee9596dd42e12698b04.tar.gz kurator-1482c7dbe3dd7de66ccffee9596dd42e12698b04.tar.bz2 |
Replaced standard output with simplistic EventLog container and scene
Diffstat (limited to 'stats/include')
-rw-r--r-- | stats/include/kurator/stats/BaseLog.h | 28 | ||||
-rw-r--r-- | stats/include/kurator/stats/BaseLog.inl.h | 33 |
2 files changed, 61 insertions, 0 deletions
diff --git a/stats/include/kurator/stats/BaseLog.h b/stats/include/kurator/stats/BaseLog.h new file mode 100644 index 0000000..142b2f2 --- /dev/null +++ b/stats/include/kurator/stats/BaseLog.h @@ -0,0 +1,28 @@ +#pragma once + +#include <variant> +#include <vector> + + +namespace kurator +{ +namespace stats +{ + + +template<typename... Events> +class BaseLog +{ +public: + template<typename Event> void push_back(Event event); + template<typename Visitor> void for_each(Visitor visitor) const; +private: + std::vector<std::variant<Events...>> events; +}; + + +} // namespace stats +} // namespace kurator + + +#include "BaseLog.inl.h" diff --git a/stats/include/kurator/stats/BaseLog.inl.h b/stats/include/kurator/stats/BaseLog.inl.h new file mode 100644 index 0000000..288f105 --- /dev/null +++ b/stats/include/kurator/stats/BaseLog.inl.h @@ -0,0 +1,33 @@ +#pragma once + +#include <utility> +#include <variant> + + +namespace kurator +{ +namespace stats +{ + + +template<typename... Events> +template<typename Event> +void +BaseLog<Events...>::push_back(Event event) +{ + events.push_back(std::move(event)); +} + + +template<typename... Events> +template<typename Visitor> +void +BaseLog<Events...>::for_each(Visitor visitor) const +{ + for (const auto& event : events) + std::visit(visitor, event); +} + + +} // namespace stats +} // namespace kurator |