Now we don't need domains as much , but something to quantify over the Event types.
What I think each Event might be the sum of smaller atomicEvents, each of it holding specific information to its type.
We would use the boolean flags of int_32 or int_64 to mark the Event type, each respectful boolean index representing a type.
like const int SpecialEvent = 0 , const int AttackEvent = 1, const int DefenseEvent = 2 .... 4, 8, ... etc.
We could introduce the operator< on Events such that EventType t1 < EventType t2 iff ( int t1 & int t2) == int t1 ( t1 contains at least all flags from t2).
Now we have subscribers which subscribe to Events types, and each subsribed Entity would be stored as pair in mutlitset<parir<EventType, Entity > .
Also we add queque's or other sequantial container's to collect atomic Events.
There is also a special queue EventTypes queue, which does stores only EventTypes as their come into , call it EventTypeQueue.
Each frame or queue we do like :
1. Trigger part : each producing Event's Entity produces EventType and puts it into EventTypeQueue.
(Note: we must test before whether there are any subscribers for that EventType)
It produces respectful atomicEvents by splitting Event into proper atomicEventsQueues.
2. Dispatch Part: for every EventType in EventTypeQueue :
Find all subscribed Entities to EventType construct Event ee from respectful atomicEventsQueues and puts them to subscribers.
(Note the subscribers are easily find by
- {l Code}: {l Select All Code}
operator<=( const int &k, const int&l ){return (k&l) == k; }) and operator<( const int &k, const int&l ){ return k!=l && k<=l})
STL set and multiset can quickly retrive desired objects by using lower_bound/upper_bound
http://www.cplusplus.com/reference/stl/set/
I think that's quite good way of having diffrent types of Events with the way of quantifiing them .