If the RT task and the server are in the same process, the STL queue is used. The class provides the structure of the local message queue and its corresponding functions. More...
#include <LocalMsgQueue.h>
Public Member Functions | |
LocalMsgQueue (const std::string &name, uint32_t queueLength) | |
~LocalMsgQueue () | |
Destructor. | |
void | postMsg (AbstractMessage *msg) |
this method pushes a notification into the queue | |
AbstractMessage * | consumeMsg () |
This method waits for the next message in the queue, retrieves the message and then consumes the message by resetting the message pointer. | |
void | purge () |
This method deletes all remaining messages in the queue. | |
uint32_t | getCurrentMsgCount () |
returns the present size of the Message Queue | |
Private Member Functions | |
LocalMsgQueue (const LocalMsgQueue &) | |
copy constructor. Private, to forbid usage. | |
LocalMsgQueue & | operator= (const LocalMsgQueue &) |
operator= Private, to forbid usage. | |
Private Attributes | |
std::priority_queue < AbstractMessage * > | msgQueue_ |
The message queue itself. | |
Mutex | accessMutex_ |
Mutex used to protect access to the queue. | |
ConditionalVariable | newMsgCondVar_ |
conditional variable that signals arrival of a new message |
If the RT task and the server are in the same process, the STL queue is used. The class provides the structure of the local message queue and its corresponding functions.
Definition at line 21 of file LocalMsgQueue.h.
fesa::LocalMsgQueue::LocalMsgQueue | ( | const std::string & | name, | |
uint32_t | queueLength | |||
) |
name | identifier of the queue | |
queueLength | maximum number of messages in the queue |
Definition at line 12 of file LocalMsgQueue.cpp.
fesa::LocalMsgQueue::~LocalMsgQueue | ( | ) |
Destructor.
Definition at line 17 of file LocalMsgQueue.cpp.
fesa::LocalMsgQueue::LocalMsgQueue | ( | const LocalMsgQueue & | ) | [private] |
copy constructor. Private, to forbid usage.
AbstractMessage * fesa::LocalMsgQueue::consumeMsg | ( | ) | [virtual] |
This method waits for the next message in the queue, retrieves the message and then consumes the message by resetting the message pointer.
Implements fesa::AbstractMsgQueue.
Definition at line 37 of file LocalMsgQueue.cpp.
References accessMutex_, msgQueue_, newMsgCondVar_, and fesa::ConditionalVariable::wait().
uint32_t fesa::LocalMsgQueue::getCurrentMsgCount | ( | ) | [virtual] |
returns the present size of the Message Queue
Implements fesa::AbstractMsgQueue.
Definition at line 52 of file LocalMsgQueue.cpp.
References accessMutex_, and msgQueue_.
LocalMsgQueue& fesa::LocalMsgQueue::operator= | ( | const LocalMsgQueue & | ) | [private] |
operator= Private, to forbid usage.
Reimplemented from fesa::AbstractMsgQueue.
void fesa::LocalMsgQueue::postMsg | ( | AbstractMessage * | msg | ) | [virtual] |
this method pushes a notification into the queue
msg | notification message as boost::shared_ptr |
FesaException | if the length of the queue is exceeded |
Implements fesa::AbstractMsgQueue.
Definition at line 21 of file LocalMsgQueue.cpp.
References accessMutex_, FesaErrorQueueLengthExceeded, fesa::AbstractMsgQueue::getQueueName(), msgQueue_, newMsgCondVar_, fesa::AbstractMsgQueue::queueLength_, and fesa::ConditionalVariable::signal().
void fesa::LocalMsgQueue::purge | ( | ) | [virtual] |
This method deletes all remaining messages in the queue.
Implements fesa::AbstractMsgQueue.
Definition at line 59 of file LocalMsgQueue.cpp.
References accessMutex_, and msgQueue_.
Mutex fesa::LocalMsgQueue::accessMutex_ [private] |
Mutex used to protect access to the queue.
Definition at line 73 of file LocalMsgQueue.h.
Referenced by consumeMsg(), getCurrentMsgCount(), postMsg(), and purge().
std::priority_queue<AbstractMessage*> fesa::LocalMsgQueue::msgQueue_ [private] |
The message queue itself.
Definition at line 68 of file LocalMsgQueue.h.
Referenced by consumeMsg(), getCurrentMsgCount(), postMsg(), and purge().
conditional variable that signals arrival of a new message
Definition at line 78 of file LocalMsgQueue.h.
Referenced by consumeMsg(), and postMsg().