diff options
Diffstat (limited to 'stats')
-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 |