29 std::map<MtEvent::Type, Dest>
m_dest{};
36 std::map<MtEvent::Type, Dest>::iterator i =
m_dest.find(e->
getType());
38 std::list<FuncSpec> &funcs = i->second.funcs;
40 (*(func.f))(e, func.d);
47 std::map<MtEvent::Type, Dest>::iterator i =
m_dest.find(type);
49 i->second.funcs.emplace_back(f, data);
52 dest.
funcs.emplace_back(f, data);
58 auto i =
m_dest.find(type);
60 std::list<FuncSpec> &funcs = i->second.funcs;
61 for (
auto j = funcs.begin(); j != funcs.end(); ) {
62 bool remove = (j->f == f && (!data || j->d == data));
static void remove(TestMap &map, size_t offset, size_t count)
Definition benchmark_mapmodify.cpp:32
Definition event_manager.h:12
~EventManager() override=default
static void receiverReceive(MtEvent *e, void *data)
Definition event_manager.h:13
void reg(MtEvent::Type type, event_receive_func f, void *data) override
Definition event_manager.h:45
std::map< MtEvent::Type, Dest > m_dest
Definition event_manager.h:29
void put(MtEvent *e) override
Definition event_manager.h:34
void dereg(MtEvent::Type type, event_receive_func f, void *data) override
Definition event_manager.h:56
virtual void onEvent(MtEvent *e)=0
Type
Definition mtevent.h:13
virtual Type getType() const =0
void(* event_receive_func)(MtEvent *e, void *data)
Definition mtevent.h:46
Definition event_manager.h:26
std::list< FuncSpec > funcs
Definition event_manager.h:27
Definition event_manager.h:19
event_receive_func f
Definition event_manager.h:20
FuncSpec(event_receive_func f, void *d)
Definition event_manager.h:22
void * d
Definition event_manager.h:21