Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
Demo::Mq::MessageQueueSystem Class Referenceabstract

#include <MessageQueueSystem.h>

+ Inheritance diagram for Demo::Mq::MessageQueueSystem:

Public Member Functions

virtual ~MessageQueueSystem ()
 
template<typename T >
void queueSendMessage (MessageQueueSystem *dstSystem, Mq::MessageId messageId, const T &msg)
 Queues message 'msg' to be sent to a destination MessageQueueSystem. More...
 
void flushQueuedMessages (void)
 Sends all the messages queued via see queueSendMessage(); Must be called from the thread that owns 'this'. More...
 
template<typename T >
void receiveMessageImmediately (Mq::MessageId messageId, const T &msg)
 Sends a message to 'this' base system immediately. More...
 

Protected Member Functions

void processIncomingMessages (void)
 Processes all incoming messages received from other threads. More...
 
virtual void processIncomingMessage (Mq::MessageId messageId, const void *data)=0
 Derived classes must implement this function to process the incoming message. More...
 

Constructor & Destructor Documentation

◆ ~MessageQueueSystem()

virtual Demo::Mq::MessageQueueSystem::~MessageQueueSystem ( )
inlinevirtual

Member Function Documentation

◆ flushQueuedMessages()

void Demo::Mq::MessageQueueSystem::flushQueuedMessages ( void  )
inline

Sends all the messages queued via see queueSendMessage(); Must be called from the thread that owns 'this'.

+ Here is the caller graph for this function:

◆ processIncomingMessage()

virtual void Demo::Mq::MessageQueueSystem::processIncomingMessage ( Mq::MessageId  messageId,
const void *  data 
)
protectedpure virtual

Derived classes must implement this function to process the incoming message.

Implemented in Demo::GraphicsSystem, and Demo::LogicSystem.

+ Here is the caller graph for this function:

◆ processIncomingMessages()

void Demo::Mq::MessageQueueSystem::processIncomingMessages ( void  )
inlineprotected

Processes all incoming messages received from other threads.

Should be called from the thread that owns 'this'

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ queueSendMessage()

template<typename T >
void Demo::Mq::MessageQueueSystem::queueSendMessage ( MessageQueueSystem dstSystem,
Mq::MessageId  messageId,
const T &  msg 
)
inline

Queues message 'msg' to be sent to a destination MessageQueueSystem.

This function must be called from the thread that owns 'this' The 'dstSystem' may live in any other thread.

Remarks
The message is not instantely delivered. It will be sent when flushQueuedMessages gets called.
Parameters
dstSystemThe MessageQueueSystem we want to send a message to.
msgThe message itself. Structure must be POD.
+ Here is the caller graph for this function:

◆ receiveMessageImmediately()

template<typename T >
void Demo::Mq::MessageQueueSystem::receiveMessageImmediately ( Mq::MessageId  messageId,
const T &  msg 
)
inline

Sends a message to 'this' base system immediately.

Use it only for time critical messages or if the sender thread doesn't own its own MessageQueueSystem class. Abusing this function can degrade performance as it would perform frequent locking. See queueSendMessage


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