Stores, queues and dispatches events as well as sending notifications to IYIEventDispatcherListener objects regarding different actions being taken on the events.
#include <event/YiEventDispatcher.h>

Static Public Member Functions | |
| static std::shared_ptr< CYIEventDispatcher > | GetDispatcher (const CYIThreadHandle &threadAffinity) |
| static const std::shared_ptr< CYIEventDispatcher > & | GetDefaultDispatcher () |
| static const CYIThreadHandle & | GetDefaultDispatcherThreadAffinity () |
| static const std::shared_ptr< CYIEventDispatcher > & | GetDrawDispatcher () |
| static void | SetDispatcher (const CYIThreadHandle &threadAffinity, const std::shared_ptr< CYIEventDispatcher > &pDispatcher) |
| static void | RemoveDispatcher (const CYIThreadHandle &threadAffinity) |
| static void | SetDefaultDispatcher (const std::shared_ptr< CYIEventDispatcher > &pDispatcher) |
| static void | RemoveDefaultDispatcher () |
| static void | SetDrawDispatcher (const std::shared_ptr< CYIEventDispatcher > &pDispatcher) |
| static void | RemoveDrawDispatcher () |
Friends | |
| class | CYIEventHandler |
| CYIEventDispatcher::CYIEventDispatcher | ( | ) |
|
virtual |
| void CYIEventDispatcher::DiscardAllPosts | ( | ) |
Clears the event queue and deletes each item.
| void CYIEventDispatcher::DiscardPosts | ( | CYIEventHandler * | pDestination | ) |
Deletes each item in the queue that belongs to pDestination.
| void CYIEventDispatcher::DiscardPostsIf | ( | bool(*)(const std::shared_ptr< CYIEventDispatcher > &, CYIEvent *, CYIEventHandler *, YI_EVENT_PRIORITY) | predicate | ) |
Deletes each item in the queue if the predicate for that event returns true.
| bool CYIEventDispatcher::Exit | ( | bool | bJoin = false, |
| bool | bWaitUntilEmpty = false |
||
| ) |
Stops the event queue.
If bJoin is true, wait for the thread to exit.
If bWaitUntilEmpty is true, wait for the queue to be empty before stopping.
|
static |
Returns the default CYIEventDispatcher.
|
static |
Returns the CYIThreadHandle of the default dispatcher.
| CYIEventHandler* CYIEventDispatcher::GetDeferredDeletionEventHandler | ( | ) |
Returns the current CYIDeferredDeletionEventHandler.
|
static |
Returns the CYIEventDispatcher belonging to threadAffinity.
|
static |
Returns the current draw dispatcher for drawing hardware-mirrored assets.
| int32_t CYIEventDispatcher::GetEventCount | ( | ) | const |
Returns the number of events in the queue.
| CYIEventHandler* CYIEventDispatcher::GetSignalEmitEventHandler | ( | ) |
Returns the current CYISignalEmitEventHandler.
| CYIEventHandler* CYIEventDispatcher::GetTaskEventHandler | ( | ) |
Returns the current CYITaskEventHandler.
| bool CYIEventDispatcher::PostEvent | ( | std::unique_ptr< CYIEvent > | pEvent, |
| YI_EVENT_PRIORITY | priority = YI_EVENT_PRIORITY_DEFAULT, |
||
| bool | bBump = false |
||
| ) |
Adds the event to the event queue with YI_EVENT_PRIORITY priority.
If bBump is true, then push it to the top of the queue. Otherwise queue it normally.
| bool CYIEventDispatcher::PostEvent | ( | std::unique_ptr< CYIEvent > | pEvent, |
| CYIEventHandler * | pDestination, | ||
| YI_EVENT_PRIORITY | priority = YI_EVENT_PRIORITY_DEFAULT, |
||
| bool | bBump = false |
||
| ) |
Adds both pEvent and pDestination to the event queue.
| bool CYIEventDispatcher::PostUniqueEvent | ( | std::unique_ptr< CYIEvent > | pEvent, |
| YI_EVENT_PRIORITY | priority = YI_EVENT_PRIORITY_DEFAULT |
||
| ) |
Adds the event to the event queue with the YI_EVENT_PRIORITY priority and deletes all previous instances of the event type.
| bool CYIEventDispatcher::PostUniqueEvent | ( | std::unique_ptr< CYIEvent > | pEvent, |
| CYIEventHandler * | pDestination, | ||
| YI_EVENT_PRIORITY | priority = YI_EVENT_PRIORITY_DEFAULT |
||
| ) |
Adds the event to the event queue with the YI_EVENT_PRIORITY priority and deletes all previous instances of the event type.
If pDestination is specified, then it gets stored in the queue along with the pEvent.
| bool CYIEventDispatcher::ProcessAllEvents | ( | ) |
Processes all events in the queue.
Returns true if there are items in the queue and the processing action is successful and false otherwise.
| bool CYIEventDispatcher::ProcessAllEvents | ( | uint64_t | uTimeoutUs | ) |
Similar to ProcessAllEvents() but it adds the uTimeoutUs parameter which will limit the time processing the events.
| bool CYIEventDispatcher::ProcessOneEvent | ( | ) |
Processes the first event in the queue if the queue is not empty.
Returns true if there are items in the queue and the processing action is successful and false otherwise.
| bool CYIEventDispatcher::RegisterEventDispatcherListener | ( | IYIEventDispatcherListener * | pEventDispatcherListener | ) |
Adds pEventDispatcherListener to the list of event dispatch listeners.
| bool CYIEventDispatcher::RegisterEventFilter | ( | CYIEventFilter * | pEventFilter | ) |
Adds pEventFilter to the list of event filters.
| bool CYIEventDispatcher::RegisterEventHandler | ( | CYIEventHandler * | pEventHandler | ) |
Adds pEventHandler to the list of event handlers.
|
static |
Clears the default event dispatcher.
|
static |
Removes the event dispatcher which belongs to threadAffinity.
|
static |
Clears the default draw event dispatcher.
| bool CYIEventDispatcher::SendEvent | ( | std::unique_ptr< CYIEvent > | pEvent | ) |
Immediately dispatches the event.
The event may be posted instead.
| bool CYIEventDispatcher::SendEvent | ( | std::unique_ptr< CYIEvent > | pEvent, |
| CYIEventHandler * | pDestination | ||
| ) |
Immediately dispatches the event.
If pDestination is specified, then it gets dispatched along with the pEvent.
The event may be posted instead.
|
static |
Sets the default event dispatcher to pDispatcher.
|
static |
Sets the event dispatcher belonging to threadAffinity to pDispatcher.
|
static |
Sets the default draw event dispatcher to pDispatcher.
| void CYIEventDispatcher::Shutdown | ( | ) |
Clears the events from the dispatcher.
| bool CYIEventDispatcher::Start | ( | ) |
Starts the event loop and event queue.
| bool CYIEventDispatcher::UnregisterEventDispatcherListener | ( | IYIEventDispatcherListener * | pEventDispatcherListener | ) |
Removes pEventDispatcherListener from the list of event dispatch listeners.
| bool CYIEventDispatcher::UnregisterEventFilter | ( | CYIEventFilter * | pEventFilter | ) |
Removes pEventFilter from the list of event filters.
| bool CYIEventDispatcher::UnregisterEventHandler | ( | CYIEventHandler * | pEventHandler | ) |
Removes pEventHandler from the list of event handlers.
| bool CYIEventDispatcher::WaitUntilEventPosted | ( | uint64_t | uTimeoutMs = 0 | ) |
Blocks until an event has been posted to the queue or times out after uTimeoutMs milliseconds.
The default value 0, represents no timeout. Returns true if the wait timed out.
| void CYIEventDispatcher::WaitUntilEventQueueRunning | ( | ) |
If the event queue is not running, blocks here until the event queue starts up.
|
friend |