Nebula
Loading...
Searching...
No Matches
Messaging::MessageCallbackHandler Class Reference

#include <messagecallbackhandler.h>

Detailed Description

Handles asynchronous message callbacks.

Allows us to perform callbacks whenever a message has been handled. Is primarily used for knowing whenever a get-something-from-another-thread-message has been handled.

For example, if we send a FetchSkinList message and want to have a callback for whenever it's handled, we can simply bind the message object to a function using the macro.

Example:

Ptr<Graphics::FetchSkinList> msg = Graphics::FetchSkinList::Create(); __Send(modelEntity, msg);
__SingleFireCallback(ViewerApplication, OnFetchedSkinList, this, msg.upcast<Messaging::Message>());

Which, when msg is handled will call this->OnFetchedSkinList with the message as argument. It sets up a specific callback delegate, not a generic one based on message type.

(C) 2013 Gustav Sterbrant (C) 2013-2020 Individual contributors, see AUTHORS file

Static Public Member Functions

template<class CLASS , void(CLASS::*)(const Ptr< Messaging::Message > &) METHOD>
static void AddCallback (const Ptr< Messaging::Message > &msg, CLASS *obj)
 setup a message callback
 
static void AbortCallback (const Ptr< Messaging::Message > &msg)
 remove a single message callback
 
template<class CLASS >
static void AbortCallbacks (CLASS *obj)
 remove all message callbacks related to a class
 
static void Update ()
 update messages
 

Static Private Attributes

static Util::Array< Ptr< Messaging::Message > > Messages
 
static Util::Array< Util::Delegate< void(const Ptr< Messaging::Message > &)> > Callbacks
 

Member Function Documentation

◆ AbortCallback()

void Messaging::MessageCallbackHandler::AbortCallback ( const Ptr< Messaging::Message > & msg)
static

remove a single message callback

◆ AbortCallbacks()

template<class CLASS >
void Messaging::MessageCallbackHandler::AbortCallbacks ( CLASS * obj)
static

remove all message callbacks related to a class

◆ AddCallback()

template<class CLASS , void(CLASS::*)(const Ptr< Messaging::Message > &) METHOD>
void Messaging::MessageCallbackHandler::AddCallback ( const Ptr< Messaging::Message > & msg,
CLASS * obj )
static

setup a message callback

◆ Update()

void Messaging::MessageCallbackHandler::Update ( )
static

update messages

Member Data Documentation

◆ Callbacks

Util::Array< Util::Delegate< void(const Ptr< Messaging::Message > &)> > Messaging::MessageCallbackHandler::Callbacks
staticprivate

◆ Messages

Util::Array< Ptr< Messaging::Message > > Messaging::MessageCallbackHandler::Messages
staticprivate

The documentation for this class was generated from the following files: