fesa-core  5.0.1
fesa::IpcMsgQueue Class Reference

If the RT and the server part are NOT in the same process, the POSIX message queue is used. The class provides the structure of the POSIX message queue and its corresponding functions. More...

#include <IpcMsgQueue.h>

Inheritance diagram for fesa::IpcMsgQueue:
fesa::AbstractMsgQueue

Public Member Functions

 IpcMsgQueue (const std::string &name, std::size_t maxNMessages, std::size_t maxMessageSize, std::size_t nDiagMessages, bool blocking)
 Constructor. More...
 
 ~IpcMsgQueue ()
 Destructor.
 
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...
 
void unlink ()
 Remove the message queue This member function should be called at process shutdown when the other process is not running.
 
- 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, MessageQueueType::MessageQueueType type, std::size_t maxNMessages, std::size_t nDiagMessages)
 Constructor. More...
 

Detailed Description

If the RT and the server part are NOT in the same process, the POSIX message queue is used. The class provides the structure of the POSIX message queue and its corresponding functions.

Constructor & Destructor Documentation

fesa::IpcMsgQueue::IpcMsgQueue ( const std::string &  name,
std::size_t  maxNMessages,
std::size_t  maxMessageSize,
std::size_t  nDiagMessages,
bool  blocking 
)

Constructor.

Parameters
nameThe name of the message queue
maxNMessagesThe maximum number of messages the queue can contain
maxMessageSizeThe maximum size of each message in bytes
nDiagMessagesThe number of messages that are reserved for diagnostics
blockingThe queue's read/write access mode
Exceptions
FesaExceptionif the message queue cannot be created because of missing root rights

Member Function Documentation

const AbstractMessage * fesa::IpcMsgQueue::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::IpcMsgQueue::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::IpcMsgQueue::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::IpcMsgQueue::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: