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.
| |||
Boole | GetMuteEvents () const | ||
Gets whether or not event firings by this publisher will be suppressed. More... | |||
void | SetMuteEvents (const Boole Mute) | ||
Sets whether or not event firings by this publisher will be suppressed. More... | |||
EventSubscriberSlot * | Subscribe (const String &EventName, EventSubscriber *Sub) | ||
Adds a subscriber to this event. More... | |||
EventSubscriberSlot * | Subscribe (const String &EventName, FunctorEventSubscriber *Funct, Boole 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 (FunctorEventSubscriber *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, FunctorEventSubscriber *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 (EventArgumentsPtr 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... | |
Boole | MuteEvents |
Stores whether or not events will actually be fired when requested. 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 54 of file eventpublisher.cpp.
|
protected |
Fires an event.
Args | The arguments/event specific data related to this event. |
Definition at line 66 of file eventpublisher.cpp.
Gets an event in this publisher.
EventName | The name of the event to retrieve. |
Definition at line 100 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 107 of file eventpublisher.cpp.
Boole Mezzanine::EventPublisher::GetMuteEvents | ( | ) | const |
Gets whether or not event firings by this publisher will be suppressed.
Definition at line 97 of file eventpublisher.cpp.
|
protected |
Removes all events in this Publisher.
Definition at line 82 of file eventpublisher.cpp.
|
protected |
Removes an existing event in this Publisher.
EventName | The name of the event to be removed. |
Definition at line 73 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::SetMuteEvents | ( | const Boole | Mute | ) |
Sets whether or not event firings by this publisher will be suppressed.
Mute | True to prevent events from firing, false for normal operation. |
Definition at line 94 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 121 of file eventpublisher.cpp.
EventSubscriberSlot * Mezzanine::EventPublisher::Subscribe | ( | const String & | EventName, |
FunctorEventSubscriber * | Funct, | ||
Boole | 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 124 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 127 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 130 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 136 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | FunctorEventSubscriber * | Funct | ) |
Unsubscribes a single subscriber all events in this publisher.
Funct | The functor to be removed. |
Definition at line 142 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 148 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 154 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 160 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 174 of file eventpublisher.cpp.
void Mezzanine::EventPublisher::Unsubscribe | ( | const String & | EventName, |
FunctorEventSubscriber * | 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 177 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 180 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 183 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 186 of file eventpublisher.cpp.
Whole Mezzanine::EventPublisher::UnsubscribeAll | ( | ) |
Unsubscribes all subscribers from all events in this publisher.
Definition at line 166 of file eventpublisher.cpp.
Unsubscribes all subscribers from the named Event.
EventName | The name of the event to unsubscribe from. |
Definition at line 189 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.
|
protected |
Stores whether or not events will actually be fired when requested.
Definition at line 70 of file eventpublisher.h.