This is a container for Events and facilitates the transfer of data. More...
#include <eventmanager.h>
Public Member Functions | |
EventManager () | |
Default constructor. More... | |
EventManager (const XML::Node &XMLNode) | |
XML constructor. More... | |
virtual | ~EventManager () |
Default Deconstructor. | |
void | AddEvent (EventBase *EventToAdd) |
Adds an event of any kind to the end of the Event Queue. More... | |
void | AddPollingCheck (const Input::MetaCode &InputToTryPolling) |
Generates extra events each iteration of the main loop, based on user input polling. More... | |
virtual void | Deinitialize () |
Removes this manager from any necessary configuration so it can be safely disposed of. More... | |
std::list< EventGameWindow * > * | GetAllGameWindowEvents () |
This returns a complete list of all the Render Time events. More... | |
std::list< EventQuit * > * | GetAllQuitEvents () |
This returns a complete list of all the quit events. More... | |
std::list< EventBase * > * | GetAllSpecificEvents (EventBase::EventType SpecificType) |
This returns a complete list of all the specified events. More... | |
std::list< EventUserInput * > * | GetAllUserInputEvents () |
This returns a complete list of all the User Input events. More... | |
EventPumpWorkUnit * | GetEventPumpWork () |
Gets the work unit responsible for pumping events from the OS. More... | |
virtual String | GetImplementationTypeName () const |
This Allows any manager name to be sent to a stream. Primarily used for logging. More... | |
virtual ManagerType | GetInterfaceType () const |
This returns the type of this manager. More... | |
EventBase * | GetNextEvent () |
Return a pointer to the Next event. More... | |
EventGameWindow * | GetNextGameWindowEvent () |
Returns a pointer to the Next GameWindow event. More... | |
EventQuit * | GetNextQuitEvent () |
Returns a pointer to the Next EventQuit. More... | |
EventBase * | GetNextSpecificEvent (EventBase::EventType SpecificType) |
Returns a pointer to the Next kind event of the Specified type. More... | |
EventUserInput * | GetNextUserInputEvent () |
Returns a pointer to the Next User Input event. More... | |
size_t | GetRemainingEventCount () |
Gets a count of events. More... | |
virtual void | Initialize () |
Configures this manager for use prior to entering the main loop. More... | |
EventBase * | PopNextEvent () |
Return a pointer to the Next event, and removes the Event from storage. More... | |
EventGameWindow * | PopNextGameWindowEvent () |
Returns a pointer to the Next GameWindow event and removes it from the Que. More... | |
EventQuit * | PopNextQuitEvent () |
Returns a pointer to the Next EventQuit and removes it from the Que. More... | |
EventBase * | PopNextSpecificEvent (EventBase::EventType SpecificType) |
Returns a pointer to the Next kind event of the Specified type, and removes it from the Que. More... | |
EventUserInput * | PopNextUserInputEvent () |
Returns a pointer to the Next User Input event and removes it from the Que. More... | |
void | RemoveAllSpecificEvents (EventBase::EventType SpecificType) |
This removes all the events of the specified type. More... | |
void | RemoveEvent (EventBase *EventToRemove) |
Removes an event of any kind from the Event Queue. More... | |
void | RemoveNextEvent () |
Removes an Event From the que without looking at it. More... | |
void | RemoveNextGameWindowEvent () |
Removes the First GameWindow Event From the que without looking at it. More... | |
void | RemoveNextQuitEvent () |
Removes the First EventQuit From the que without looking at it. More... | |
void | RemoveNextSpecificEvent (EventBase::EventType SpecificType) |
Returns a pointer to the Next kind event of the Specified type, and removes it from the Que. More... | |
void | RemoveNextUserInputEvent () |
Removes the First User Input Event From the que without looking at it. More... | |
void | RemovePollingCheck (const Input::MetaCode &InputToStopPolling) |
Removes Events from the list(s) of what needs to be polled. More... | |
void | UpdateEvents () |
Pulls Events from the all the subsystems for use in the EventManager. More... | |
Public Member Functions inherited from Mezzanine::EntresolManager | |
EntresolManager () | |
Class constructor. | |
virtual | ~EntresolManager () |
Class destructor. | |
Public Member Functions inherited from Mezzanine::ManagerBase | |
ManagerBase () | |
Class constructor. | |
virtual | ~ManagerBase () |
Class destructor. | |
virtual String | GetInterfaceTypeAsString () const |
Gets a string of the interface type of this manager. More... | |
Boole | IsInitialized () const |
Gets whether or not this manager has been initialized. More... | |
Public Member Functions inherited from Mezzanine::Singleton< EventManager > | |
~Singleton () | |
Class destructor. | |
Static Public Attributes | |
static const String | ImplementationName = "DefaultEventManager" |
A String containing the name of this manager implementation. | |
static const ManagerBase::ManagerType | InterfaceType = ManagerBase::MT_EventManager |
A ManagerType enum value used to describe the type of interface/functionality this manager provides. | |
Protected Member Functions | |
EventManager (const EventManager &Dummy) | |
Private copy semantics, because copying this will cause problems. More... | |
void | UpdateQuitEvents () |
Checks for quit messages and adds them to the queue. More... | |
friend | void::operator>> (const Mezzanine::XML::Node &OneNode, Mezzanine::EventManager &Mgr) |
Protected Member Functions inherited from Mezzanine::Singleton< EventManager > | |
Singleton () | |
Class constructor. | |
Protected Attributes | |
Internal::EventManagerInternalData * | _Data |
All the internal data for this EventManager. More... | |
Protected Attributes inherited from Mezzanine::ManagerBase | |
Boole | Initialized |
Simple Boole indicating whether or not this manager has been initialized. More... | |
Entresol * | TheEntresol |
The actual pointer to the Entresol core class. More... | |
Friends | |
class | EventWorkUnit |
std::ostream & | operator<< (std::ostream &stream, const Mezzanine::EventManager &Mgr) |
Serializes the passed Mezzanine::EventManager to XML. More... | |
std::istream & | operator>> (std::istream &stream, Mezzanine::EventManager &Mgr) |
Deserialize a Mezzanine::EventManager. More... | |
Additional Inherited Members | |
Public Types inherited from Mezzanine::ManagerBase | |
enum | ManagerType { MT_Undefined = 0, MT_AudioManager = 1, MT_AnimationManager = 2, MT_CollisionShapeManager = 3, MT_CompositorManager = 4, MT_GraphicsManager = 5, MT_EventManager = 6, MT_InputManager = 7, MT_LogManager = 8, MT_MaterialManager = 9, MT_MeshManager = 10, MT_NetworkManager = 11, MT_ResourceManager = 12, MT_ScriptingManager = 13, MT_TextureManager = 14, MT_UIManager = 15, MT_ActorManager = 101, MT_AreaEffectManager = 102, MT_DebrisManager = 103, MT_PagingManager = 104, MT_PhysicsManager = 105, MT_SceneManager = 106, MT_SoundScapeManager = 107, MT_TerrainManager = 108, MT_VehicleManager = 109, MT_UserCreated = 512 } |
A listing of Manager Types. More... | |
Static Public Member Functions inherited from Mezzanine::ManagerBase | |
static String | GetTypeAsString (const ManagerType &ManagerType) |
Gets the string form of the type of manager. More... | |
static ManagerType | GetTypeFromString (const String &ManagerName) |
Gets the type of manager requested from a string. More... | |
Static Public Member Functions inherited from Mezzanine::Singleton< EventManager > | |
static EventManager * | GetSingletonPtr () |
Fetches a pointer to the singleton. More... | |
static Boole | SingletonValid () |
Checks to see if the singleton pointer is valid. More... | |
Static Protected Attributes inherited from Mezzanine::Singleton< EventManager > | |
static EventManager * | SingletonPtr |
The one and only pointer to the single object. More... | |
This is a container for Events and facilitates the transfer of data.
The Event Manager Exists to passed important information about Gamestate from where it is generated to where it is needed. It is the Game Developers option whether they want to grab events directly using the get functions that have filters, or if they want to get all the events at once from a central location and dispatch form there.
Since all User input comes in the form of events, this is also where user input Polling and optional input sources like Joysticks are controlled from.
All of these event are stored in an internal Queue and order is preserved. So the First item In will be the First Out (FIFO). This is not strictly a FIFO buffer, there are a number of functions for getting of managing specific kinds of events. Generally these 'Filtered' management functions Still return the first of those kinds of event.
Definition at line 160 of file eventmanager.h.
|
inlineprotected |
Private copy semantics, because copying this will cause problems.
Dummy | A dummy argument |
Since copying, or having more than one event manager doesn't seem to make sense I just made it non-copyable.
Definition at line 180 of file eventmanager.h.
Mezzanine::EventManager::EventManager | ( | ) |
Default constructor.
Definition at line 276 of file eventmanager.cpp.
Mezzanine::EventManager::EventManager | ( | const XML::Node & | XMLNode | ) |
XML constructor.
XMLNode | The node of the xml document to construct from. |
Definition at line 293 of file eventmanager.cpp.
void Mezzanine::EventManager::AddEvent | ( | EventBase * | EventToAdd | ) |
Adds an event of any kind to the end of the Event Queue.
EventToAdd | This is a pointer to an Event. |
This adds the existing event to the Queue. Be careful this is not delete, and does not go out of scope. Deleting the Event is now the responsibilty of the code that pulls it out of Event Manager.
Definition at line 378 of file eventmanager.cpp.
void Mezzanine::EventManager::AddPollingCheck | ( | const Input::MetaCode & | InputToTryPolling | ) |
Generates extra events each iteration of the main loop, based on user input polling.
InputToTryPolling | This accepts a MetaCode and will try to watch for occurences like this one |
This will trigger the input system to generate an event (or add to an exiting event) when polling for the given kind of event. Each Iteration of the main loop there will be a EventUserInput that created. That Event will Include all the normal metacodes for user input that happened, and it will also have a meta code for each time this function was called. The added metacode may be partialky ignored, the Metavalue is almost always ignored, and in a situation where the can only be one of a given input on a system, the ID is ignore and 0 is assumed.
Unsupported Polling Check on this Platform | When the metacode passed cannot be polled on this platform |
Definition at line 635 of file eventmanager.cpp.
|
virtual |
Removes this manager from any necessary configuration so it can be safely disposed of.
Implements Mezzanine::ManagerBase.
Definition at line 662 of file eventmanager.cpp.
std::list< EventGameWindow * > * Mezzanine::EventManager::GetAllGameWindowEvents | ( | ) |
This returns a complete list of all the Render Time events.
This finds all the EventUserInput Events then creates a new list and returns that. This runs in linear time relative to the amounts of events.
Definition at line 528 of file eventmanager.cpp.
std::list< EventQuit * > * Mezzanine::EventManager::GetAllQuitEvents | ( | ) |
This returns a complete list of all the quit events.
This finds all the EventQuit Events then creates a new list and returns that. This runs in linear time relative to the amounts of events.
Definition at line 558 of file eventmanager.cpp.
std::list< EventBase * > * Mezzanine::EventManager::GetAllSpecificEvents | ( | EventBase::EventType | SpecificType | ) |
This returns a complete list of all the specified events.
This finds all the events that are of the specified type in the event manager, then creates a new list and return that. This runs in linear time relative to the amounts of events.
Definition at line 605 of file eventmanager.cpp.
std::list< EventUserInput * > * Mezzanine::EventManager::GetAllUserInputEvents | ( | ) |
This returns a complete list of all the User Input events.
This finds all the EventUserInput Events then creates a new list and returns that. This runs in linear time relative to the amounts of events.
Definition at line 543 of file eventmanager.cpp.
EventPumpWorkUnit * Mezzanine::EventManager::GetEventPumpWork | ( | ) |
Gets the work unit responsible for pumping events from the OS.
Definition at line 671 of file eventmanager.cpp.
|
virtual |
This Allows any manager name to be sent to a stream. Primarily used for logging.
Implements Mezzanine::ManagerBase.
Definition at line 680 of file eventmanager.cpp.
|
virtual |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implements Mezzanine::ManagerBase.
Definition at line 677 of file eventmanager.cpp.
EventBase * Mezzanine::EventManager::GetNextEvent | ( | ) |
Return a pointer to the Next event.
This returns a pointer to the next Event. It is advisable to use this for performance reasons because it runs in constant time. However it does not return a specific kind of event, and must be cast in order to use the true content. This returns a pointer to 0 if there are no events in the queue.
Definition at line 358 of file eventmanager.cpp.
EventGameWindow * Mezzanine::EventManager::GetNextGameWindowEvent | ( | ) |
Returns a pointer to the Next GameWindow event.
This Filtered event management function returns a pointer to the next GameWindow event. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no GameWindow events in the que.
Definition at line 519 of file eventmanager.cpp.
EventQuit * Mezzanine::EventManager::GetNextQuitEvent | ( | ) |
Returns a pointer to the Next EventQuit.
This Filtered event management function returns a pointer to the next EventQuit. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no EventQuit events in the que.
Definition at line 549 of file eventmanager.cpp.
EventBase * Mezzanine::EventManager::GetNextSpecificEvent | ( | EventBase::EventType | SpecificType | ) |
Returns a pointer to the Next kind event of the Specified type.
SpecificType | This is a Event::EventType that defines the type you want this to work with |
This and the other NextSpecificEvent functions are the core of the Event Filtering System. In general the other filtering functions call one of these and does very little work on their own.
This performs a linear search starting with the oldest (first entered Events) and simply checks if it the of the correct type. Then this returns a pointer to the next event of the specified type, or returns a pointer to 0 if there are none of the correct pointers in the Que. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events.
Definition at line 564 of file eventmanager.cpp.
EventUserInput * Mezzanine::EventManager::GetNextUserInputEvent | ( | ) |
Returns a pointer to the Next User Input event.
This Filtered event management function returns a pointer to the next User Input event. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no User Input events in the que.
Definition at line 534 of file eventmanager.cpp.
size_t Mezzanine::EventManager::GetRemainingEventCount | ( | ) |
Gets a count of events.
This returns a total count of all events stored in this EventManager.
Definition at line 355 of file eventmanager.cpp.
|
virtual |
Configures this manager for use prior to entering the main loop.
Implements Mezzanine::ManagerBase.
Definition at line 653 of file eventmanager.cpp.
EventBase * Mezzanine::EventManager::PopNextEvent | ( | ) |
Return a pointer to the Next event, and removes the Event from storage.
This functions just like GetNextEvent , except that it also removes the item from the internal storage of the EventManager. This returns a pointer to 0 if there are no events in the que.
Definition at line 366 of file eventmanager.cpp.
EventGameWindow * Mezzanine::EventManager::PopNextGameWindowEvent | ( | ) |
Returns a pointer to the Next GameWindow event and removes it from the Que.
This Filtered event management function returns a pointer to the next GameWindow event. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no GameWindow events in the que. This also removes the returned pointer form the Que.
Definition at line 522 of file eventmanager.cpp.
EventQuit * Mezzanine::EventManager::PopNextQuitEvent | ( | ) |
Returns a pointer to the Next EventQuit and removes it from the Que.
This Filtered event management function returns a pointer to the next EventQuit. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no EventQuit events in the que. This also removes the returned pointer form the Que.
Definition at line 552 of file eventmanager.cpp.
EventBase * Mezzanine::EventManager::PopNextSpecificEvent | ( | EventBase::EventType | SpecificType | ) |
Returns a pointer to the Next kind event of the Specified type, and removes it from the Que.
SpecificType | This is a Event::EventType that defines the type you want this to work with |
This is just like GetNextSpecificEvent(Event::EventType SpecificType) but it also removes the item from the Que.
Definition at line 578 of file eventmanager.cpp.
EventUserInput * Mezzanine::EventManager::PopNextUserInputEvent | ( | ) |
Returns a pointer to the Next User Input event and removes it from the Que.
This Filtered event management function returns a pointer to the next User Input event. It is inadvisable to use this for performance reasons because it runs in linear time relative to the amount of events. However, it will return an immediately usable pointer for case where an extreme level of performance is not required. This returns a pointer to 0 if there are no User Input events in the que. This also removes the returned pointer form the Que.
Definition at line 537 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveAllSpecificEvents | ( | EventBase::EventType | SpecificType | ) |
This removes all the events of the specified type.
This finds all the events that are of the specified type in the event manager, then removes them.
Definition at line 619 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveEvent | ( | EventBase * | EventToRemove | ) |
Removes an event of any kind from the Event Queue.
EventToRemove | Pointer to the event that will be removed. |
In most cases you will want to use the PopNextEvent() methods when going through events. In some expert use cases however you may want to remove a specific event at an arbitrary place in the Queue. This is the method for doing so.
Definition at line 381 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveNextEvent | ( | ) |
Removes an Event From the que without looking at it.
This together with GetNextEvent() are the same as call PopNextEvent().
This | can throw any STL exception a que could. Any with likely throw some kind of except if called when there are no Events in the Que. |
Definition at line 375 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveNextGameWindowEvent | ( | ) |
Removes the First GameWindow Event From the que without looking at it.
This together with GetNextGameWindowEvent() are the pretty much same as call PopNextGameWindowEvent().
This | can throw any STL exception a queue could. And with likely throw some kind of except if called when there are no Events in the Que. |
Definition at line 525 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveNextQuitEvent | ( | ) |
Removes the First EventQuit From the que without looking at it.
This together with GetNextQuitEvent() are the pretty much same as call PopNextQuitEvent().
This | can throw any STL exception a queue could. And with likely throw some kind of except if called when there are no Events in the Que. |
Definition at line 555 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveNextSpecificEvent | ( | EventBase::EventType | SpecificType | ) |
Returns a pointer to the Next kind event of the Specified type, and removes it from the Que.
SpecificType | This is a Event::EventType that defines the type you want this to work with |
This is just like PopNextSpecificEvent(Event::EventType SpecificType) but exept it doesn't bother with any of the needed structure involved with returning data, and just removes the specific event from the Queue.
This | can throw any STL exception a queue could. And with likely throw some kind of except if called when there are no Events in the Que. |
Definition at line 593 of file eventmanager.cpp.
void Mezzanine::EventManager::RemoveNextUserInputEvent | ( | ) |
Removes the First User Input Event From the que without looking at it.
This together with GetNextUserInputEvent() are the pretty much same as call PopNextUserInputEvent().
This | can throw any STL exception a queue could. And with likely throw some kind of except if called when there are no Events in the Que. |
Definition at line 540 of file eventmanager.cpp.
void Mezzanine::EventManager::RemovePollingCheck | ( | const Input::MetaCode & | InputToStopPolling | ) |
Removes Events from the list(s) of what needs to be polled.
InputToStopPolling | This accepts a MetaCode and will try to Remove Watches like this one |
This will remove any check for polling that share the same inputcode and ID. This
Polling check not present | Is thrown |
Definition at line 645 of file eventmanager.cpp.
void Mezzanine::EventManager::UpdateEvents | ( | ) |
Pulls Events from the all the subsystems for use in the EventManager.
The work this function does is already performed in the main loop. This only really needs to be used If a game developer chooses to use his own main loop. This adds system events, like EventQuit and Other Windows manager events, and if any user input event actions, this generates one EventUserInput that stores everythin that happened.
Definition at line 393 of file eventmanager.cpp.
|
protected |
Checks for quit messages and adds them to the queue.
Definition at line 336 of file eventmanager.cpp.
|
friend |
Serializes the passed Mezzanine::EventManager to XML.
stream | The ostream to send the xml to. |
Mgr | the Mezzanine::EventManager to be serialized |
Definition at line 721 of file eventmanager.cpp.
|
friend |
Deserialize a Mezzanine::EventManager.
stream | The istream to get the xml from to (re)make the Mezzanine::EventManager. |
Mgr | the Mezzanine::EventManager to be deserialized. |
Definition at line 733 of file eventmanager.cpp.
|
protected |
All the internal data for this EventManager.
Definition at line 170 of file eventmanager.h.