5#include <bnb/utils/class_unique_id.hpp>
6#include <bnb/utils/static_pool_allocator.hpp>
7#include <bnb/utils/allocate_unique.hpp>
8#include <bnb/utils/defs.hpp>
12#include <unordered_map>
22 using event_id_t = size_t;
23 using handler_id_t = size_t;
28 bool is_required =
false;
46 virtual event_id_t get_type_id()
const noexcept = 0;
49 template<
typename Event,
size_t MaxElements = 3 * 2>
57 event_id_t get_type_id()
const noexcept final
66 template<
typename Event>
70 using time_stamp_t = std::chrono::time_point<std::chrono::high_resolution_clock>;
72 : time_stamp(std::chrono::high_resolution_clock::now())
75 const time_stamp_t time_stamp;
78 template<
typename T,
int Count>
82 template<
typename... Args>
99 using params_t = std::unordered_map<std::string, std::string>;
100 explicit effect_event(
const std::string& a_name,
const params_t& a_params)
106 const std::string name;
107 const params_t params;
110 using base_event_ptr = std::shared_ptr<const base_event_iface>;
114 using event_uptr = std::unique_ptr<T, base_event_deleter>;
116 using base_event_uptr = event_uptr<const base_event_iface>;
119 template<
typename T,
typename... Args>
120 inline std::unique_ptr<T, base_event_deleter> make_unique_event(Args&&... args)
122 return allocate_unique<T,
typename T::allocator, base_event_deleter, Args&&...>(
123 typename T::allocator(),
124 std::forward<Args>(args)...