fesa-core  4.3.1
fesa::AbstractMsgQueue Class Referenceabstract

An abstract message queue. The concrete implementation (the STL queue or the IPC queue) depends on the deployment mode (mixed or split) More...

#include <AbstractMsgQueue.h>

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

Public Member Functions

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...
 
virtual std::size_t getNMessages () const =0
 Get the number of messages that are currently in the queue. More...
 
virtual void postMsg (const AbstractMessage *msg)=0
 Put a message into the queue. More...
 
virtual const AbstractMessageconsumeMsg ()=0
 Wait for the next message in the queue, retrieve the message and consume the message by resetting the message pointer. More...
 
virtual void purge ()=0
 Delete all the messages in the queue. 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...
 

Protected Member Functions

 AbstractMsgQueue (const std::string &name, MessageQueueType::MessageQueueType type, std::size_t maxNMessages, std::size_t nDiagMessages)
 Constructor. More...
 

Detailed Description

An abstract message queue. The concrete implementation (the STL queue or the IPC queue) depends on the deployment mode (mixed or split)

Constructor & Destructor Documentation

fesa::AbstractMsgQueue::AbstractMsgQueue ( const std::string &  name,
MessageQueueType::MessageQueueType  type,
std::size_t  maxNMessages,
std::size_t  nDiagMessages 
)
protected

Constructor.

Parameters
nameThe name of the queue
typeThe type of the queue
maxNMessagesThe maximal number of messages the queue can contain
nDiagMessagesThe number of messages reserved for diagnostics

Member Function Documentation

void fesa::AbstractMsgQueue::checkState ( uint32_t  msgPrio) const

Check if the queue is full or "almost" full.

Parameters
msgPrioIf msgPrio is HIGH, notify will work even if the queue is "almost" full
Exceptions
FesaExceptionif the queue is full or "almost" full
virtual const AbstractMessage* fesa::AbstractMsgQueue::consumeMsg ( )
pure 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

Implemented in fesa::IpcMsgQueue, and fesa::LocalMsgQueue.

std::size_t fesa::AbstractMsgQueue::getMaxMessageSize ( ) const
virtual

Get the maximal size of a message in bytes.

Returns
The maximal size of a message
std::size_t fesa::AbstractMsgQueue::getMaxNMessages ( ) const
inline

Get the maximal number of messages the queue can contain.

Returns
The queue's maximal number of messages
const std::string & fesa::AbstractMsgQueue::getName ( ) const
inline

Get the queue's name.

Returns
The queue's name
virtual std::size_t fesa::AbstractMsgQueue::getNMessages ( ) const
pure virtual

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

Returns
The number of messages in the queue

Implemented in fesa::IpcMsgQueue, and fesa::LocalMsgQueue.

bool fesa::AbstractMsgQueue::isAlmostFull ( ) const

Check if the queue is "almost" full (i.e. only diagnostics messages are allowed)

Returns
true if the queue is "almost" full, false otherwise
bool fesa::AbstractMsgQueue::isFull ( ) const

Check if the queue is full.

Returns
true if the queue is full, false otherwise
virtual void fesa::AbstractMsgQueue::postMsg ( const AbstractMessage msg)
pure virtual

Put a message into the queue.

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

Implemented in fesa::IpcMsgQueue, and fesa::LocalMsgQueue.

virtual void fesa::AbstractMsgQueue::purge ( )
pure virtual

Delete all the messages in the queue.

Exceptions
FesaException

Implemented in fesa::IpcMsgQueue, and fesa::LocalMsgQueue.


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