F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Os::Queue Class Referencefinal

#include <Os/Queue.hpp>

Inheritance diagram for Os::Queue:
Os::QueueInterface

Public Member Functions

 Queue ()
 queue constructor More...
 
virtual ~Queue ()
 default queue destructor More...
 
 Queue (const Queue &other)=delete
 copy constructor is forbidden More...
 
 Queue (const Queue *other)=delete
 copy constructor is forbidden More...
 
QueueInterfaceoperator= (const QueueInterface &other) override=delete
 assignment operator is forbidden More...
 
Status create (const Fw::StringBase &name, FwSizeType depth, FwSizeType messageSize) override
 create queue storage through delegate More...
 
Status send (const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
 send a message into the queue through delegate More...
 
Status receive (U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
 receive a message from the queue through delegate More...
 
FwSizeType getMessagesAvailable () const override
 get number of messages available More...
 
FwSizeType getMessageHighWaterMark () const override
 get maximum messages stored at any given time through delegate More...
 
QueueHandlegetHandle () override
 return the underlying queue handle (implementation specific). Delegates to implementation. More...
 
Status send (const Fw::SerializeBufferBase &message, FwQueuePriorityType priority, BlockingType blockType)
 send a message to a queue More...
 
Status receive (Fw::SerializeBufferBase &destination, BlockingType blockType, FwQueuePriorityType &priority)
 receive a message from a queue More...
 
FwSizeType getDepth () const
 get the queue's depth in messages More...
 
FwSizeType getMessageSize () const
 get the queue's message maximum size More...
 
const QueueStringgetName () const
 get the queue's name More...
 
- Public Member Functions inherited from Os::QueueInterface
 QueueInterface ()=default
 default queue interface constructor More...
 
virtual ~QueueInterface ()=default
 default queue destructor More...
 
 QueueInterface (const QueueInterface &other)=delete
 copy constructor is forbidden More...
 
 QueueInterface (const QueueInterface *other)=delete
 copy constructor is forbidden More...
 

Static Public Member Functions

static FwSizeType getNumQueues ()
 get number of queues system-wide More...
 
static Os::MutexgetStaticMutex ()
 get static mutex More...
 
- Static Public Member Functions inherited from Os::QueueInterface
static QueueInterfacegetDelegate (QueueHandleStorage &aligned_placement_new_memory)
 provide a pointer to a queue delegate object More...
 

Additional Inherited Members

- Public Types inherited from Os::QueueInterface
enum  Status {
  OP_OK , ALREADY_CREATED , EMPTY , UNINITIALIZED ,
  SIZE_MISMATCH , SEND_ERROR , RECEIVE_ERROR , INVALID_PRIORITY ,
  FULL , UNKNOWN_ERROR
}
 status returned from the queue send function More...
 
enum  BlockingType { BLOCKING , NONBLOCKING }
 message type More...
 

Detailed Description

Definition at line 153 of file Queue.hpp.

Constructor & Destructor Documentation

◆ Queue() [1/3]

Os::Queue::Queue ( )

queue constructor

Definition at line 14 of file Queue.cpp.

◆ ~Queue()

Os::Queue::~Queue ( )
virtual

default queue destructor

Definition at line 16 of file Queue.cpp.

◆ Queue() [2/3]

Os::Queue::Queue ( const Queue other)
delete

copy constructor is forbidden

◆ Queue() [3/3]

Os::Queue::Queue ( const Queue other)
delete

copy constructor is forbidden

Member Function Documentation

◆ create()

QueueInterface::Status Os::Queue::create ( const Fw::StringBase name,
FwSizeType  depth,
FwSizeType  messageSize 
)
overridevirtual

create queue storage through delegate

Creates a queue ensuring sufficient storage to hold depth messages of messageSize size each. This method delegates to the underlying implementation. Resource allocation is dependent on the underlying implementation and users should assume that resource allocation is possible.

Parameters
namename of queue
depthdepth of queue in number of messages
messageSizesize of an individual message
Returns
: status of the creation

Implements Os::QueueInterface.

Definition at line 20 of file Queue.cpp.

◆ getDepth()

FwSizeType Os::Queue::getDepth ( ) const

get the queue's depth in messages

Definition at line 115 of file Queue.cpp.

◆ getHandle()

QueueHandle * Os::Queue::getHandle ( )
overridevirtual

return the underlying queue handle (implementation specific). Delegates to implementation.

Returns
internal task handle representation

Implements Os::QueueInterface.

Definition at line 87 of file Queue.cpp.

◆ getMessageHighWaterMark()

FwSizeType Os::Queue::getMessageHighWaterMark ( ) const
overridevirtual

get maximum messages stored at any given time through delegate

Returns the maximum number of messages in this queue at any given time. This is the high-water mark for this queue.

Returns
queue message high-water mark

Implements Os::QueueInterface.

Definition at line 82 of file Queue.cpp.

◆ getMessagesAvailable()

FwSizeType Os::Queue::getMessagesAvailable ( ) const
overridevirtual

get number of messages available

Returns the number of messages currently available in the queue. This method delegates to the underlying implementation.

Returns
number of messages available

Implements Os::QueueInterface.

Definition at line 77 of file Queue.cpp.

◆ getMessageSize()

FwSizeType Os::Queue::getMessageSize ( ) const

get the queue's message maximum size

Definition at line 119 of file Queue.cpp.

◆ getName()

const QueueString & Os::Queue::getName ( ) const

get the queue's name

Definition at line 123 of file Queue.cpp.

◆ getNumQueues()

FwSizeType Os::Queue::getNumQueues ( )
static

get number of queues system-wide

Definition at line 127 of file Queue.cpp.

◆ getStaticMutex()

Os::Mutex & Os::Queue::getStaticMutex ( )
static

get static mutex

Definition at line 132 of file Queue.cpp.

◆ operator=()

QueueInterface& Os::Queue::operator= ( const QueueInterface other)
overridevirtualdelete

assignment operator is forbidden

Reimplemented from Os::QueueInterface.

◆ receive() [1/2]

Status Os::Queue::receive ( Fw::SerializeBufferBase destination,
BlockingType  blockType,
FwQueuePriorityType priority 
)

receive a message from a queue

Receive a message from a queue with the given block type. See: QueueInterface::receive. Note: this will entirely overwrite the buffer.

Warning
This method will block if the queue is full and blockType is set to BLOCKING
Parameters
destinationreference to serialize buffer for storing message
priority(output) priority of the message
blockTypeBLOCKING to block for space or NONBLOCKING to return error when queue is full
Returns
status of the send

◆ receive() [2/2]

Status Os::Queue::receive ( U8 destination,
FwSizeType  capacity,
BlockingType  blockType,
FwSizeType actualSize,
FwQueuePriorityType priority 
)
overridevirtual

receive a message from the queue through delegate

Receive a message from the queue, providing the message destination, capacity, priority, and blocking type. When blockType is set to BLOCKING, this call will block on queue empty. Otherwise, this will return an error status on queue empty. Actual size received and priority of message is set on success status. This method delegates to the underlying implementation.

Warning
It is invalid to send a null buffer.
This method will block if the queue is empty and blockType is set to BLOCKING
Parameters
destinationdestination for message data
capacitymaximum size of message data
blockTypeBLOCKING to wait for message or NONBLOCKING to return error when queue is empty
actualSize(output) actual size of message read
priority(output) priority of message read
Returns
: status of the send

Implements Os::QueueInterface.

◆ send() [1/2]

Status Os::Queue::send ( const Fw::SerializeBufferBase message,
FwQueuePriorityType  priority,
BlockingType  blockType 
)

send a message to a queue

Send a message to a queue with the given priority and block type. See: QueueInterface::send

Warning
This method will block if the queue is full and blockType is set to BLOCKING
Parameters
messagereference to serialize buffer storing message
prioritypriority of the message
blockTypeBLOCKING to block for space or NONBLOCKING to return error when queue is full
Returns
status of the send

◆ send() [2/2]

Status Os::Queue::send ( const U8 buffer,
FwSizeType  size,
FwQueuePriorityType  priority,
BlockingType  blockType 
)
overridevirtual

send a message into the queue through delegate

Send a message into the queue, providing the message data, size, priority, and blocking type. When blockType is set to BLOCKING, this call will block on queue full. Otherwise, this will return an error status on queue full. This method delegates to the underlying implementation.

Warning
It is invalid to send a null buffer
This method will block if the queue is full and blockType is set to BLOCKING
Parameters
buffermessage data
sizesize of message data
prioritypriority of the message
blockTypeBLOCKING to block for space or NONBLOCKING to return error when queue is full
Returns
: status of the send

Implements Os::QueueInterface.


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