40 #ifndef _eventpublisher_cpp
41 #define _eventpublisher_cpp
43 #include "eventpublisher.h"
60 Ev =
new Event(EventName);
61 this->
Events[EventName] = Ev;
76 if( EvIt != this->
Events.end() ) {
77 delete (*EvIt).second;
86 delete (*EvIt).second;
103 if( EvIt != this->
Events.end() )
return (*EvIt).second;
110 if( EvIt != this->
Events.end() ) {
111 return (*EvIt).second;
139 { (*EventIt).second->Unsubscribe(Subscriber); }
145 { (*EventIt).second->Unsubscribe(Funct); }
151 { (*EventIt).second->Unsubscribe(CFunct); }
157 { (*EventIt).second->Unsubscribe(SubScript); }
163 { (*EventIt).second->Unsubscribe(SubSlot); }
170 { Ret += (*EventIt).second->UnsubscribeAll(); }
Basic class definition for functors used by a FunctorSubscriberSlot.
Event * GetEventExcept(const String &EventName) const
Gets an event in this publisher. version differs from the non-except version in that if it fails to f...
bool Boole
Generally acts a single bit, true or false.
EventPublisher()
Class constructor.
Event * GetEvent(const String &EventName) const
Gets an event in this publisher.
This class represents a given event that can be subscribed to and/or fired.
EventContainer Events
A container storing all the Events published by this class by name.
Thrown when the requested identity could not be found.
This is a base class for all classes that subscribe to events.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
A simple reference counting pointer.
EventSubscriberSlot * Subscribe(const String &EventName, EventSubscriber *Sub)
Adds a subscriber to this event.
virtual ~EventPublisher()
Class destructor.
EventContainer::const_iterator ConstEventIterator
Const Iterator type for Event instances stored by this class.
The interface for a script.
Whole UnsubscribeAll()
Unsubscribes all subscribers from this Event.
void RemoveAllEvents()
Removes all events in this Publisher.
void( SubscriberFunction)(EventArgumentsPtr Args)
This is a convenience typedef for a c-style method that accepts EventArguments.
void SetMuteEvents(const Boole Mute)
Sets whether or not event firings by this publisher will be suppressed.
void Unsubscribe(EventSubscriber *Subscriber)
Unsubscribes a single subscriber all events in this publisher.
void Unsubscribe(EventSubscriber *Subscriber)
Unsubscribes a single subscriber from this event.
void _FireEvent(EventArgumentsPtr Args)
Notifies all subscribers of this event that this event is firing.
Event * AddEvent(const String &EventName)
Creates a new event this Publisher can fire.
This class represents a slot in an event that can be subscribed to via subscribers, functors, or methods.
void FireEvent(EventArgumentsPtr Args)
Fires an event.
Boole MuteEvents
Stores whether or not events will actually be fired when requested.
EventSubscriberSlot * Subscribe(EventSubscriber *Subscriber)
Adds a subscriber to this event.
Whole UnsubscribeAll()
Unsubscribes all subscribers from all events in this publisher.
void RemoveEvent(const String &EventName)
Removes an existing event in this Publisher.
The bulk of the engine components go in this namspace.
EventContainer::iterator EventIterator
Iterator type for Event instances stored by this class.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Boole GetMuteEvents() const
Gets whether or not event firings by this publisher will be suppressed.
std::string String
A datatype used to a series of characters.