#include <hps.h>

Public Member Functions | |
bool | Equals (EventDispatcher const &in_that) const |
EventDispatcher () | |
EventDispatcher (EventDispatcher const &in_that) | |
EventDispatcher (EventDispatcher &&in_that) | |
bool | InjectEvent (Event const &in_event) const |
EventNotifier | InjectEventWithNotifier (Event const &in_event) const |
bool | IsShutdown () const |
HPS::Type | ObjectType () const |
bool | operator!= (EventDispatcher const &in_that) const |
EventDispatcher & | operator= (EventDispatcher &&in_that) |
EventDispatcher & | operator= (EventDispatcher const &in_that) |
bool | operator== (EventDispatcher const &in_that) const |
void | SetName (char const *in_name) const |
void | ShowName (UTF8 &out_name) const |
void | Shutdown () const |
bool | Subscribe (EventHandler const &in_handler, intptr_t in_type) const |
bool | UnSubscribe (EventHandler const &in_handler, intptr_t in_type) const |
bool | UnSubscribe (EventHandler const &in_handler) const |
bool | UnSubscribe (intptr_t in_type) const |
![]() | |
virtual bool | Empty () const |
intptr_t | GetClassID () const |
intptr_t | GetInstanceID () const |
bool | HasType (HPS::Type in_mask) const |
Object (Object const &that) | |
Object (Object &&in_that) | |
Object & | operator= (Object const &other_object) |
Object & | operator= (Object &&in_that) |
virtual HPS::Type | Type () const |
Static Public Attributes | |
static const HPS::Type | staticType = HPS::Type::EventDispatcher |
![]() | |
static const HPS::Type | staticType = HPS::Type::None |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static intptr_t | ClassID () |
Detailed Description
The EventDispatcher class is used for injecting any events and dealing with event handlers which handle those events.
Constructor & Destructor Documentation
◆ EventDispatcher() [1/3]
HPS::EventDispatcher::EventDispatcher | ( | ) |
The default constructor creates an uninitialized EventDispatcher object which cannot be subscribed to.
◆ EventDispatcher() [2/3]
HPS::EventDispatcher::EventDispatcher | ( | EventDispatcher const & | in_that | ) |
The copy constructor creates an EventDispatcher object that points to the same underlying impl as the source EventDispatcher.
- Parameters
-
in_that The source EventHandler to point to.
◆ EventDispatcher() [3/3]
HPS::EventDispatcher::EventDispatcher | ( | EventDispatcher && | in_that | ) |
The move constructor creates a EventDispatcher by transferring the underlying impl of the rvalue reference to this EventDispatcher thereby avoiding a copy and allocation.
- Parameters
-
in_that An rvalue reference to a EventDispatcher to take the impl from.
Member Function Documentation
◆ Equals()
bool HPS::EventDispatcher::Equals | ( | EventDispatcher const & | in_that | ) | const |
Check if the source EventDispatcher is equivalent to this object.
- Parameters
-
in_that The source EventDispatcher to compare to this object.
- Returns
- true if the objects are equivalent, false otherwise.
◆ InjectEvent()
bool HPS::EventDispatcher::InjectEvent | ( | Event const & | in_event | ) | const |
Inject the specified event and propagate it to all subscribed handlers in the order of subscription.
- Parameters
-
in_event Event to inject and propagate.
- Returns
- true if the event injection was successful, false otherwise.
◆ InjectEventWithNotifier()
EventNotifier HPS::EventDispatcher::InjectEventWithNotifier | ( | Event const & | in_event | ) | const |
Inject the specified event and propagate it to all subscribed handlers in the order of subscription and return an EventNotifier associated with the injected event.
- Parameters
-
in_event Event to inject and propagate.
- Returns
- An event notifier associated with the injected event.
◆ IsShutdown()
bool HPS::EventDispatcher::IsShutdown | ( | ) | const |
Query whether the asynchronous shutdown has completed.
- Returns
- true if the event dispatcher has shutdown, false otherwise.
◆ ObjectType()
|
inlinevirtual |
This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
- Returns
- The declared type of the object in question, which may differ from the true, underlying type.
Reimplemented from HPS::Object.
◆ operator!=()
bool HPS::EventDispatcher::operator!= | ( | EventDispatcher const & | in_that | ) | const |
Check if the source EventDispatcher is not equivalent to this object.
- Parameters
-
in_that The source EventDispatcher to compare to this object.
- Returns
- true if the objects are not equivalent, false otherwise.
◆ operator=() [1/2]
EventDispatcher& HPS::EventDispatcher::operator= | ( | EventDispatcher && | in_that | ) |
The move assignment operator transfers the underlying impl of the rvalue reference to this EventDispatcher thereby avoiding a copy.
- Parameters
-
in_that An rvalue reference to an EventDispatcher to take the impl from.
- Returns
- A reference to this EventDispatcher.
◆ operator=() [2/2]
EventDispatcher& HPS::EventDispatcher::operator= | ( | EventDispatcher const & | in_that | ) |
Associate this EventDispatcher with the same underlying impl as the source EventDispatcher.
- Parameters
-
in_that The source EventDispatcher for the assignment.
- Returns
- A reference to this EventDispatcher.
◆ operator==()
bool HPS::EventDispatcher::operator== | ( | EventDispatcher const & | in_that | ) | const |
Check if the source EventDispatcher is equivalent to this object.
- Parameters
-
in_that The source EventDispatcher to compare to this object.
- Returns
- true if the objects are equivalent, false otherwise.
◆ SetName()
void HPS::EventDispatcher::SetName | ( | char const * | in_name | ) | const |
Sets the EventDispatcher's name
- Parameters
-
in_name Name to set.
◆ ShowName()
void HPS::EventDispatcher::ShowName | ( | UTF8 & | out_name | ) | const |
Shows the EventDispatcher's name
- Parameters
-
out_name Current name of this EventDispatcher.
◆ Shutdown()
void HPS::EventDispatcher::Shutdown | ( | ) | const |
Shutdown this EventDispatcher asynchronously. Any pending events injected into this EventDispatcher will be processed prior to shutdown, but no new events can be injected.
◆ Subscribe()
bool HPS::EventDispatcher::Subscribe | ( | EventHandler const & | in_handler, |
intptr_t | in_type | ||
) | const |
Add the specified event handler to the list of subscribers for events of the specified type on this EventDispatcher.
- Parameters
-
in_handler Event handler to add to the subscriber list for events of the given type. in_type Type of event to add the handler for.
- Returns
- true if the subscription was successful, false otherwise.
◆ UnSubscribe() [1/3]
bool HPS::EventDispatcher::UnSubscribe | ( | EventHandler const & | in_handler, |
intptr_t | in_type | ||
) | const |
Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.
- Parameters
-
in_handler Event handler to remove from the subscriber list for events of the given type. in_type Type of event to remove the handler for.
- Returns
- true if the unsubscription was successful, false otherwise.
◆ UnSubscribe() [2/3]
bool HPS::EventDispatcher::UnSubscribe | ( | EventHandler const & | in_handler | ) | const |
Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.
- Parameters
-
in_handler Event handler to remove from the subscriber list for events of the given type. in_type Type of event to remove the handler for.
- Returns
- true if the unsubscription was successful, false otherwise.
◆ UnSubscribe() [3/3]
bool HPS::EventDispatcher::UnSubscribe | ( | intptr_t | in_type | ) | const |
Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.
- Parameters
-
in_type Type of event to remove the handler for.
- Returns
- true if the unsubscription was successful, false otherwise.
The documentation for this class was generated from the following file:
- include/hps.h