This is the base class for any class that generates and publishes events to subscribers. More...
#include <eventpublisher.h>
Public Types | |
typedef EventContainer::const_iterator | ConstEventIterator |
Const Iterator type for Event instances stored by this class. | |
typedef std::map< String, Event * > | EventContainer |
Basic container type for Event storage by this class. | |
typedef EventContainer::iterator | EventIterator |
Iterator type for Event instances stored by this class. | |
Public Member Functions | |||
EventPublisher () | |||
Class constructor. | |||
virtual | ~EventPublisher () | ||
Class destructor. | |||
Event * | GetEvent (const String &EventName) const | ||
Gets an event in this publisher. More... | |||
Event * | GetEventExcept (const String &EventName) const | ||
Gets an event in this publisher.
| |||
EventSubscriberSlot * | Subscribe (const String &EventName, EventSubscriber *Sub) | ||
Adds a subscriber to this event. More... | |||
EventSubscriberSlot * | Subscribe (const String &EventName, FunctorSubscriberSlot::FunctorDefinition *Funct, Boolean CleanUpAfter) | ||
Subscribes a functor object to this event. More... | |||
EventSubscriberSlot * | Subscribe (const String &EventName, CFunctionSubscriberSlot::SubscriberFunction *CFunct) | ||
Subscribes a C-style function to this event. More... | |||
EventSubscriberSlot * | Subscribe (const String &EventName, Scripting::iScript *SubScript) | ||
Subscribes a script to this event. More... | |||
void | Unsubscribe (EventSubscriber *Subscriber) | ||
Unsubscribes a single subscriber all events in this publisher. More... | |||
void | Unsubscribe (FunctorSubscriberSlot::FunctorDefinition *Funct) | ||
Unsubscribes a single subscriber all events in this publisher. More... | |||
void | Unsubscribe (CFunctionSubscriberSlot::SubscriberFunction *CFunct) | ||
Unsubscribes a single subscriber from all events in this publisher. More... | |||
void | Unsubscribe (Scripting::iScript *SubScript) | ||
Unsubscribes a single subscriber from all events in this publisher. More... | |||
void | Unsubscribe (EventSubscriberSlot *SubSlot) | ||
Unsubscribes a single subscriber from all events in this publisher. More... | |||
void | Unsubscribe (const String &EventName, EventSubscriber *Subscriber) | ||
Unsubscribes a single subscriber from the named event. More... | |||
void | Unsubscribe (const String &EventName, FunctorSubscriberSlot::FunctorDefinition *Funct) | ||
Unsubscribes a single subscriber from the named event. More... | |||
void | Unsubscribe (const String &EventName, CFunctionSubscriberSlot::SubscriberFunction *CFunct) | ||
Unsubscribes a single subscriber from the named event. More... | |||
void | Unsubscribe (const String &EventName, Scripting::iScript *SubScript) | ||
Unsubscribes a single subscriber from the named event. More... | |||
void | Unsubscribe (const String &EventName, EventSubscriberSlot *SubSlot) | ||
Unsubscribes a single subscriber from the named event. More... | |||
Whole | UnsubscribeAll () | ||
Unsubscribes all subscribers from all events in this publisher. More... | |||
Whole | UnsubscribeAll (const String &EventName) | ||
Unsubscribes all subscribers from the named Event. More... | |||
Protected Member Functions | |
Event * | AddEvent (const String &EventName) |
Creates a new event this Publisher can fire. More... | |
void | FireEvent (const EventArguments &Args) |
Fires an event. More... | |
void | RemoveAllEvents () |
Removes all events in this Publisher. More... | |
void | RemoveEvent (const String &EventName) |
Removes an existing event in this Publisher. More... | |
Protected Attributes | |
EventContainer | Events |
A container storing all the Events published by this class by name. More... | |
This is the base class for any class that generates and publishes events to subscribers.
Definition at line 55 of file eventpublisher.h.
Creates a new event this Publisher can fire.
EventName | The name to be given to the new event. |
Definition at line 53 of file eventpublisher.cpp.
|
protected |
Fires an event.
Args | The arguments/event specific data related to this event. |
Definition at line 65 of file eventpublisher.cpp.
Gets an event in this publisher.
EventName | The name of the event to retrieve. |
Definition at line 89 of file eventpublisher.cpp.
Gets an event in this publisher.
This | version differs from the non-except version in that if it fails to find the event specified it will throw a "II_IDENTITY_NOT_FOUND_EXCEPTION". |
EventName | The name of the event to retrieve. |
Definition at line 96 of file eventpublisher.cpp.
|
protected |
Removes all events in this Publisher.
Definition at line 77 of file eventpublisher.cpp.
|
protected |
Removes an existing event in this Publisher.
EventName | The name of the event to be removed. |
Definition at line 68 of file eventpublisher.cpp.
EventSubscriberSlot * Mezzanine::EventPublisher::Subscribe | ( | const String & | EventName, |
EventSubscriber * | Sub | ||
) |
Adds a subscriber to this event.
EventName | The name of the event to subscribe to. |
Sub | The custom event subscriber. |
Definition at line 110 of file eventpublisher.cpp.
EventSubscriberSlot * Mezzanine::EventPublisher::Subscribe | ( | const String & | EventName, |
FunctorSubscriberSlot::FunctorDefinition * | Funct, | ||
Boolean | CleanUpAfter | ||
) |
Subscribes a functor object to this event.
EventName | The name of the event to subscribe to. |
Funct | The functor to call when the event is fired. |
CleanUpAfter | Whether or not to delete the functor when this subscriber is no longer subscribed to any events. |
Definition at line 113 of file eventpublisher.cpp.
EventSubscriberSlot * Mezzanine::EventPublisher::Subscribe | ( | const String & | EventName, |
CFunctionSubscriberSlot::SubscriberFunction * | CFunct | ||
) |
Subscribes a C-style function to this event.
EventName | The name of the event to subscribe to. |
CFunct | The C-style function to call when the event is fired. |
Definition at line 116 of file eventpublisher.cpp.
EventSubscriberSlot * Mezzanine::EventPublisher::Subscribe | ( | const String & | EventName, |
Scripting::iScript * | SubScript | ||
) |
Subscribes a script to this event.
EventName | The name of the event to subscribe to. |
SubScript | The subscribed script to execute when the event is fired. |
Definition at line 119 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | EventSubscriber * | Subscriber) |
Unsubscribes a single subscriber all events in this publisher.
Subscriber | The EventSubscriberSlot (and the subscriber it is holding) to be removed. |
Definition at line 125 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | FunctorSubscriberSlot::FunctorDefinition * | Funct) |
Unsubscribes a single subscriber all events in this publisher.
Funct | The functor to be removed. |
Definition at line 131 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | CFunctionSubscriberSlot::SubscriberFunction * | CFunct) |
Unsubscribes a single subscriber from all events in this publisher.
CFunct | The function to be removed. |
Definition at line 137 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | Scripting::iScript * | SubScript) |
Unsubscribes a single subscriber from all events in this publisher.
SubScript | The Script to be removed. |
Definition at line 143 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | EventSubscriberSlot * | SubSlot) |
Unsubscribes a single subscriber from all events in this publisher.
SubSlot | The EventSubscriberSlot (and the subscriber it is holding) to be removed. |
Definition at line 149 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
EventSubscriber * | Subscriber | ||
) |
Unsubscribes a single subscriber from the named event.
EventName | The name of the event to unsubscribe from. |
Subscriber | The EventSubscriberSlot (and the subscriber it is holding) to be removed. |
Definition at line 163 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
FunctorSubscriberSlot::FunctorDefinition * | Funct | ||
) |
Unsubscribes a single subscriber from the named event.
EventName | The name of the event to unsubscribe from. |
Funct | The functor to be removed. |
Definition at line 166 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
CFunctionSubscriberSlot::SubscriberFunction * | CFunct | ||
) |
Unsubscribes a single subscriber from the named event.
EventName | The name of the event to unsubscribe from. |
CFunct | The function to be removed. |
Definition at line 169 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
Scripting::iScript * | SubScript | ||
) |
Unsubscribes a single subscriber from the named event.
EventName | The name of the event to unsubscribe from. |
SubScript | The Script to be removed. |
Definition at line 172 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
EventSubscriberSlot * | SubSlot | ||
) |
Unsubscribes a single subscriber from the named event.
EventName | The name of the event to unsubscribe from. |
SubSlot | The EventSubscriberSlot (and the subscriber it is holding) to be removed. |
Definition at line 175 of file eventpublisher.cpp.
Whole Mezzanine::EventPublisher::UnsubscribeAll | ( | ) |
Unsubscribes all subscribers from all events in this publisher.
Definition at line 155 of file eventpublisher.cpp.
Unsubscribes all subscribers from the named Event.
EventName | The name of the event to unsubscribe from. |
Definition at line 178 of file eventpublisher.cpp.
|
protected |
A container storing all the Events published by this class by name.
Definition at line 67 of file eventpublisher.h.