App::cMessageManager class

The implementation of IMessageManager; this should only be used for extending and detouring.

Base classes

class IMessageManager
This manager defines a messaging system, that allows communication between different parts of the code.

Public functions

auto Initialize() -> bool override
auto Dispose() -> bool override
auto GetOption(Options option) -> bool override
Returns the boolean value of the specified option, in the IMessageManager::Options enum.
auto SetOption(Options option, bool bValue) -> void override
Sets the boolean value of the specified option, in the IMessageManager::Options enum.
auto MessageSend(uint32_t messageID, void* pMessage, IUnmanagedMessageListener* pListener) -> void override
Sends a message in this manager, notifying all the interfaces listening for the specified message ID.
auto MessagePost(uint32_t messageID, IMessageRC* pMessage, IMessageListener* pListener) -> void override
auto MessagePostFunction(uint32_t messageID, IMessageRC* pMessage, int, MessageHandler_t handler, void*) -> void override
auto AddListener(IMessageListener* pListener, uint32_t messageID) -> void override
Adds a message listener to this manager, that will be notified of messages with the specified ID.
auto AddUnmanagedListener(IUnmanagedMessageListener* pListener, uint32_t messageID) -> void override
Same as IMessageManager::AddListener(), but this does not call AddRef().
auto AddHandler(IMessageManager::MessageHandler_t pFunction, void* pObject, uint32_t messageID, bool bRefCounted, int nPriority) -> void override
Adds a static handler function to this manager, that will be notified of messages with the specified ID.
auto RemoveListener(IUnmanagedMessageListener* pListener, uint32_t messageID, int nPriority) -> bool override
Makes the listener stop listening to the specified message ID.
auto RemoveHandler(IMessageManager::MessageHandler_t pFunction, uint32_t messageID, int nPriority) -> bool override
Makes the handler stop listening to the specified message ID.
auto ProcessQueue(int, int, int) -> int override
auto ProcessQueue2() -> int override
auto GetMessageQueue() -> int override
auto Lock(bool bLock) -> int override
Locks or unlocks the mutexs in this manager, allowing to safely interact with this manager in different threads.
auto AddEntry(const IMessageManager::Entry& entry, uint32_t messageID) -> void override
Adds the entry to listen to the given message ID.
auto RemoveEntry(void* pMessageObject, uint32_t messageID, int nPriority) -> bool override
Removes the entry assigned at the given messageID with the given priority.

Public variables

char field_04
Mutex field_38
int field_68
int field_6C
eastl::hash_map<uint32_t, eastl::list<IMessageListener*>> mListeners
Mutex mListenersMutex
bool field_C0

Function documentation

bool App::cMessageManager::GetOption(Options option) override

Returns the boolean value of the specified option, in the IMessageManager::Options enum.

Parameters
option The option whose value will be returned.

void App::cMessageManager::SetOption(Options option, bool bValue) override

Sets the boolean value of the specified option, in the IMessageManager::Options enum.

Parameters
option The option whose value will be set.
bValue The new boolean value of the option.

void App::cMessageManager::MessageSend(uint32_t messageID, void* pMessage, IUnmanagedMessageListener* pListener) override

Sends a message in this manager, notifying all the interfaces listening for the specified message ID.

Parameters
messageID The ID this message notifies.
pMessage Data related to the message, not all messages need to use this.
pListener [Optional] The IMessageListener that will receive this message. If this is specified, no other listener will be notified.

void App::cMessageManager::AddListener(IMessageListener* pListener, uint32_t messageID) override

Adds a message listener to this manager, that will be notified of messages with the specified ID.

Parameters
pListener The message listener to add.
messageID The ID of the messages the listener is listening to.

A single listener can be listening to multiple message IDs. If the kOptionRefCount option is true, the IMessageListener::AddRef() method will be called on the listener.

void App::cMessageManager::AddUnmanagedListener(IUnmanagedMessageListener* pListener, uint32_t messageID) override

Same as IMessageManager::AddListener(), but this does not call AddRef().

Parameters
pListener The message listener to add.
messageID The ID of the messages the listener is listening to.

void App::cMessageManager::AddHandler(IMessageManager::MessageHandler_t pFunction, void* pObject, uint32_t messageID, bool bRefCounted, int nPriority) override

Adds a static handler function to this manager, that will be notified of messages with the specified ID.

Parameters
pFunction A pointer to the handler function.
pObject An object that will be sent as a parameter in the handler function.
messageID The ID of the messages the handler is listening to.
bRefCounted [Optional] If true and kOptionRefCount is true, a kMsgAddRef message will be sent on the handler.
nPriority [Optional] The priority of this handler.

The same handler can be added multiple times using different priorities.

bool App::cMessageManager::RemoveListener(IUnmanagedMessageListener* pListener, uint32_t messageID, int nPriority) override

Makes the listener stop listening to the specified message ID.

Parameters
pListener The listener to remove.
messageID The ID of the messages the listener is listening to, and that will stop listening.
nPriority [Optional] The priority the listener must have to be removed. If it's -9999 (by default), it will be ignored.
Returns Whether the handler was removed or not.

Optionally, a priority can be specified; if so, only if the listener with that priority will be removed.

bool App::cMessageManager::RemoveHandler(IMessageManager::MessageHandler_t pFunction, uint32_t messageID, int nPriority) override

Makes the handler stop listening to the specified message ID.

Parameters
pFunction The handler function to remove.
messageID The ID of the messages the handler is listening to, and that will stop listening.
nPriority [Optional] The priority the handler must have to be removed. If it's -9999 (by default), it will be ignored.
Returns Whether the handler was removed or not.

Optionally, a priority can be specified; if so, only if the handler with that priority will be removed.

int App::cMessageManager::Lock(bool bLock) override

Locks or unlocks the mutexs in this manager, allowing to safely interact with this manager in different threads.

Parameters
bLock True -> Lock; False -> Unlock

If kOptionAllowLock is not true, this won't do anything.

void App::cMessageManager::AddEntry(const IMessageManager::Entry& entry, uint32_t messageID) override

Adds the entry to listen to the given message ID.

Parameters
entry The entry that contains the listener or handler function.
messageID The message ID the entry will be notified.

bool App::cMessageManager::RemoveEntry(void* pMessageObject, uint32_t messageID, int nPriority) override

Removes the entry assigned at the given messageID with the given priority.

Parameters
pMessageObject The handler or listener to remove.
messageID The message ID the entry will be removed from.
nPriority [Optional] The priority of the entry to be removed.
Returns Whether the entry was removed or not.

If the priority is -9999, it will be ignored. If the entry is refcounted and kOptionRefCount is true, Release() will be called on the listener (or a kMsgRelease will be sent to the handler). This function works for both listeners and handlers.