A generic implementation of the Observer design pattern. The Event class allows a generic event handler to be created. The template parameter of the class is the type of the object in the one and only parameter of the receivers. Each time a function is added to an Event, a function object is created for that function and class object using the boost::bind function. The function object is then stored in the list of receivers for the Event. When the Event is notified to transmit data, all receivers for the Event are called with the given object as their one and only parameter. Any particular class object may store only one function in the Event’s receiver list--any other functions it tries to add will not be stored.
Event.h
A generic implementation of the Observer design pattern. | |
The Event constructor. | |
Adds a new function object to the receiver list for this Event. | |
Removes a function object from the receiver list for this Event. | |
Calls all of the function objects for this Event. | |
Returns how many receivers this Event has. | |
Indicates whether the Event is transmitting to receivers right now. | |
Turns a function signature and class object into a function object. | |
Deletes a function object from the receiver list. | |
Whether the Event is transmitting to receivers right now. | |
The list of receivers for this Event. | |
The list of receivers to be deleted when this Event stops transmitting. |
The Event constructor. | |
Adds a new function object to the receiver list for this Event. | |
Removes a function object from the receiver list for this Event. | |
Calls all of the function objects for this Event. | |
Returns how many receivers this Event has. | |
Indicates whether the Event is transmitting to receivers right now. |
|
Removes a function object from the receiver list for this Event. If the receiver is currently being trasmitted to, it is set aside in a special list marked for deletion later.
| func | The function signature of the receiver. |
| object | The class object the function signature belongs to. |
|
Turns a function signature and class object into a function object.
| func | The function signature of the receiver. |
| object | The class object the function signature belongs to. |
A function object wrapping the function signature and class object.
|
|
|
|
| const wxUint32 NumReceivers() |
| const bool IsTransmitting() |
|
|
| bool mInTransmit |
| ReceiverList mReceiverList |
| ReceiverList mRemoveList |