fesa-core  7.0.0
fesa::LocalMsgQueue Class Reference

If the real-time and the server parts 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

Public Member Functions

 LocalMsgQueue (const std::string &name, std::size_t maxNMessages, std::size_t nDiagMessages)
 
std::size_t getNMessages () const
 Get the number of messages that are currently in the queue. More...
 
void postMsg (const AbstractMessage *msg)
 Put a message into the queue. More...
 
const AbstractMessageconsumeMsg ()
 Wait for the next message in the queue, retrieve the message and consume the message by resetting the message pointer. More...
 
void purge ()
 Delete all the messages in the queue. More...
 
- Public Member Functions inherited from fesa::AbstractMsgQueue
virtual ~AbstractMsgQueue ()
 Destructor.
 
const std::string & getName () const
 Get the queue's name. More...
 
std::size_t getMaxNMessages () const
 Get the maximal number of messages the queue can contain. More...
 
virtual std::size_t getMaxMessageSize () const
 Get the maximal size of a message in bytes. More...
 
bool isFull () const
 Check if the queue is full. More...
 
bool isAlmostFull () const
 Check if the queue is "almost" full (i.e. only diagnostics messages are allowed) More...
 
void checkState (uint32_t msgPrio) const
 Check if the queue is full or "almost" full. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fesa::AbstractMsgQueue
 AbstractMsgQueue (const std::string &name, std::size_t maxNMessages, std::size_t nDiagMessages)
 Constructor. More...
 

Detailed Description

If the real-time and the server parts are in the same process, the STL queue is used. The class provides the structure of the local message queue and its corresponding functions.

Constructor & Destructor Documentation

fesa::LocalMsgQueue::LocalMsgQueue ( const std::string &  name,
std::size_t  maxNMessages,
std::size_t  nDiagMessages 
)
Parameters
nameidentifier of the queue
maxNMessagesThe maximal number of messages the queue can contain
nDiagMessagesThe number of messages that are reserved for diagnostics

Member Function Documentation

const AbstractMessage * fesa::LocalMsgQueue::consumeMsg ( )
virtual

Wait for the next message in the queue, retrieve the message and consume the message by resetting the message pointer.

Returns
The pointer to the consumed message
Exceptions
FesaException

Implements fesa::AbstractMsgQueue.

std::size_t fesa::LocalMsgQueue::getNMessages ( ) const
virtual

Get the number of messages that are currently in the queue.

Returns
The number of messages in the queue

Implements fesa::AbstractMsgQueue.

void fesa::LocalMsgQueue::postMsg ( const AbstractMessage msg)
virtual

Put a message into the queue.

Parameters
msgA message
Exceptions
FesaExceptionif the queue's size is exceeded

Implements fesa::AbstractMsgQueue.

void fesa::LocalMsgQueue::purge ( )
virtual

Delete all the messages in the queue.

Exceptions
FesaException

Implements fesa::AbstractMsgQueue.


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