i6engine
1.0
|
Interface for every class that wants to subscribe to the messaging system. More...
#include <D:/Projekte/i6engine/libs/i6engine-core/include/i6engine/core/messaging/MessageSubscriber.h>
Public Member Functions | |
MessageSubscriber () | |
Standard constructor. More... | |
virtual | ~MessageSubscriber () |
Destructor. More... | |
void | receiveMessage (const Message::Ptr &msg) |
This method is called from the MessagingController. It stores incoming messages in a local buffer. More... | |
virtual void | processMessages () |
This method goes through the local message buffer and calls the appropriate method of the receiver. More... | |
void | notifyNewID (const int64_t id) |
This method notifies the MessagingController that Messages waiting for this id can now be delivered. More... | |
void | buffer (const ReceivedMessagePtr &msg) |
Calls deliverMessageInternal if the message should be delivered now, buffers it if not. More... | |
void | reset () |
todo More... | |
void | addMethod (uint16_t msgType, const boost::function< void(const Message::Ptr &)> &ptrMessageMethod) |
adds a method for given message type where messages shall be delivered More... | |
void | removeMethod (uint16_t msgType) |
removes method for given message type More... | |
Protected Member Functions | |
void | swapMessageBuffer () |
This method will swap the double message buffer. For synchronization reasons. More... | |
bool | updateBuffer () |
This method delivers all waiting Messages that can now be delivered. More... | |
virtual void | deliverMessageInternal (const ReceivedMessagePtr &msg) |
This method really delivers the Message without buffering it anymore. More... | |
Protected Attributes | |
boost::mutex | _objMessageVectorMutex |
MessageVector | _objMessageVectorA |
MessageVector | _objMessageVectorB |
MessageVector * | _objActiveMessageVector |
MessageVector * | _objInActiveMessageVector |
std::map< uint16_t, boost::function< void(const Message::Ptr &)> > | _ptrMessageMethod |
Interface for every class that wants to subscribe to the messaging system.
All instances of the classes SubSystem and GOComponent inherit from this class.
MessageVector
is an alias for std::vector<ReceivedMessage>Definition at line 76 of file MessageSubscriber.h.
|
inline |
Standard constructor.
Definition at line 81 of file MessageSubscriber.h.
|
inlinevirtual |
Destructor.
Definition at line 87 of file MessageSubscriber.h.
|
inline |
adds a method for given message type where messages shall be delivered
Definition at line 123 of file MessageSubscriber.h.
void i6e::core::MessageSubscriber::buffer | ( | const ReceivedMessagePtr & | msg | ) |
Calls deliverMessageInternal if the message should be delivered now, buffers it if not.
msg | Message to be be delivered. |
|
protectedvirtual |
void i6e::core::MessageSubscriber::notifyNewID | ( | const int64_t | id | ) |
This method notifies the MessagingController that Messages waiting for this id can now be delivered.
id | The new id. |
|
virtual |
This method goes through the local message buffer and calls the appropriate method of the receiver.
It is called prior to a tick in the main loop of every subsystem. This class must not be called explicitely. Subject to future refactoring to private scope.
Reimplemented in i6e::core::ModuleController.
void i6e::core::MessageSubscriber::receiveMessage | ( | const Message::Ptr & | msg | ) |
This method is called from the MessagingController. It stores incoming messages in a local buffer.
objMessage | The message to be stored in the buffer. |
|
inline |
removes method for given message type
Definition at line 130 of file MessageSubscriber.h.
void i6e::core::MessageSubscriber::reset | ( | ) |
todo
|
protected |
This method will swap the double message buffer. For synchronization reasons.
|
protected |
This method delivers all waiting Messages that can now be delivered.
|
protected |
Definition at line 159 of file MessageSubscriber.h.
|
protected |
Definition at line 160 of file MessageSubscriber.h.
|
protected |
Definition at line 157 of file MessageSubscriber.h.
|
protected |
Definition at line 158 of file MessageSubscriber.h.
|
protected |
Definition at line 156 of file MessageSubscriber.h.
|
protected |
Definition at line 162 of file MessageSubscriber.h.