FormIt C++ API  v23.0.0 (2023.0.0)
FormIt::MessageListener Class Reference

Description

#include <FormItMessaging.h>

Public Types

using MessageStruct = FormIt::MessageStruct
 
using MessagePayloadStruct = FormIt::MessagePayloadStruct
 
using MessageHandlerFunc = 1::function< void(MessageStruct const &message, MessagePayloadStruct const &)>
 

Public Member Functions

 MessageListener (int priority=0)
 Constructor also sets the listener priority. More...
 
virtual ~MessageListener ()
 The destructor unsubscribes this listener from all messages in the broadcaster. More...
 
virtual void ReceiveMessage (MessageStruct const &message, MessagePayloadStruct const &payload)
 The purpose of this class. More...
 
void ReceiveAllMessages (MessageStruct const &message, MessagePayloadStruct const &payload)
 
void Subscribe (MessageStruct const &message)
 Convenience method for calling in to the MessageBroadcaster from within the Listener. More...
 
void Subscribe (MessageStruct const &message, MessageHandlerFunc const &func)
 Convenience method for calling in to the MessageBroadcaster from within the Listener. More...
 
void Subscribe (1::string const &message, MessageHandlerFunc const &func)
 Convenience method for calling in to the MessageBroadcaster from within the Listener. More...
 
void Subscribe (1::string const &message)
 
void SubscribeAllMessages (MessageHandlerFunc const &func)
 
void Unsubscribe (1::string const &message)
 Convenience method for calling in to the MessageBroadcaster from within the Listener. More...
 
int ListenerPriority () const
 Gets the listener priority. More...
 

Member Typedef Documentation

using FormIt::MessageListener::MessageHandlerFunc = 1::function<void(MessageStruct const &message, MessagePayloadStruct const &)>

Constructor & Destructor Documentation

FormIt::MessageListener::MessageListener ( int  priority = 0)
inline

Constructor also sets the listener priority.

Listeners are called lowest number to highest, so lowest number wins. Priority needs to be set before Subscribe, as Subscribe sorts by priority

virtual FormIt::MessageListener::~MessageListener ( )
inlinevirtual

The destructor unsubscribes this listener from all messages in the broadcaster.

Member Function Documentation

int FormIt::MessageListener::ListenerPriority ( ) const
inline

Gets the listener priority.

Listeners are called lowest number to highest, so lowest number wins.

void FormIt::MessageListener::ReceiveAllMessages ( MessageStruct const &  message,
MessagePayloadStruct const &  payload 
)
inline
virtual void FormIt::MessageListener::ReceiveMessage ( MessageStruct const &  message,
MessagePayloadStruct const &  payload 
)
inlinevirtual

The purpose of this class.

void FormIt::MessageListener::Subscribe ( MessageStruct const &  message)
inline

Convenience method for calling in to the MessageBroadcaster from within the Listener.

void FormIt::MessageListener::Subscribe ( MessageStruct const &  message,
MessageHandlerFunc const &  func 
)
inline

Convenience method for calling in to the MessageBroadcaster from within the Listener.

void FormIt::MessageListener::Subscribe ( 1::string const &  message,
MessageHandlerFunc const &  func 
)
inline

Convenience method for calling in to the MessageBroadcaster from within the Listener.

void FormIt::MessageListener::Subscribe ( 1::string const &  message)
inline
void FormIt::MessageListener::SubscribeAllMessages ( MessageHandlerFunc const &  func)
inline
void FormIt::MessageListener::Unsubscribe ( 1::string const &  message)
inline

Convenience method for calling in to the MessageBroadcaster from within the Listener.


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