fesa::LocalMsgQueue Class Reference

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>

Inheritance diagram for fesa::LocalMsgQueue:
fesa::AbstractMsgQueue

List of all members.

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
AbstractMessageconsumeMsg ()
 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.
LocalMsgQueueoperator= (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

Detailed Description

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.


Constructor & Destructor Documentation

fesa::LocalMsgQueue::LocalMsgQueue ( const std::string &  name,
uint32_t  queueLength 
)
Parameters:
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.


Member Function Documentation

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.

Returns:
pointer to the consumed message

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

Returns:
currentMessageCount

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

Parameters:
msg notification message as boost::shared_ptr
Exceptions:
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_.


Member Data Documentation

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().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1