F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Os::QueueCommon< T > Class Template Reference

#include <Os/Queue.hpp>

Inheritance diagram for Os::QueueCommon< T >:
Os::QueueUserInterface

Public Member Functions

 QueueCommon ()
 queue constructor More...
 
 ~QueueCommon ()
 default queue destructor More...
 
 QueueCommon (const QueueCommon &other)=delete
 copy constructor is forbidden More...
 
 QueueCommon (const QueueCommon *other)=delete
 copy constructor is forbidden More...
 
QueueCommon & operator= (const QueueCommon &other)=delete
 assignment operator is forbidden More...
 
Status create (FwEnumStoreType id, const Fw::ConstStringBase &name, FwSizeType depth, FwSizeType messageSize)
 create queue storage through delegate More...
 
void teardown ()
 teardown the queue More...
 
Status send (const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType)
 send a message into the queue through delegate More...
 
Status receive (U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority)
 receive a message from the queue through delegate More...
 
FwSizeType getMessagesAvailable () const
 get number of messages available More...
 
FwSizeType getMessageHighWaterMark () const
 get maximum messages stored at any given time through delegate More...
 
QueueHandle * getHandle ()
 return the underlying queue handle (implementation specific). Delegates to implementation. More...
 
Status send (const Fw::LinearBufferBase &message, FwQueuePriorityType priority, BlockingType blockType)
 send a message to a queue More...
 
Status receive (Fw::LinearBufferBase &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 QueueString & getName () const
 get the queue's name More...
 

Static Public Member Functions

static FwSizeType getNumQueues ()
 get number of queues system-wide More...
 
static Os::Mutex & getStaticMutex ()
 get static mutex More...
 

Additional Inherited Members

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

Detailed Description

template<typename T>
class Os::QueueCommon< T >

Definition at line 23 of file Queue.hpp.

Constructor & Destructor Documentation

◆ QueueCommon() [1/3]

template<typename T >
Os::QueueCommon< T >::QueueCommon ( )

queue constructor

Definition at line 229 of file Queue.hpp.

◆ ~QueueCommon()

template<typename T >
Os::QueueCommon< T >::~QueueCommon ( )

default queue destructor

Definition at line 232 of file Queue.hpp.

◆ QueueCommon() [2/3]

template<typename T >
Os::QueueCommon< T >::QueueCommon ( const QueueCommon< T > &  other)
delete

copy constructor is forbidden

◆ QueueCommon() [3/3]

template<typename T >
Os::QueueCommon< T >::QueueCommon ( const QueueCommon< T > *  other)
delete

copy constructor is forbidden

Member Function Documentation

◆ create()

template<typename T >
QueueUserInterface::Status Os::QueueCommon< T >::create ( FwEnumStoreType  id,
const Fw::ConstStringBase &  name,
FwSizeType  depth,
FwSizeType  messageSize 
)

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

Definition at line 235 of file Queue.hpp.

◆ getDepth()

template<typename T >
FwSizeType Os::QueueCommon< T >::getDepth ( ) const

get the queue's depth in messages

Definition at line 342 of file Queue.hpp.

◆ getHandle()

template<typename T >
QueueHandle * Os::QueueCommon< T >::getHandle ( )

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

Returns
internal task handle representation

Definition at line 312 of file Queue.hpp.

◆ getMessageHighWaterMark()

template<typename T >
FwSizeType Os::QueueCommon< T >::getMessageHighWaterMark ( ) const

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

Definition at line 307 of file Queue.hpp.

◆ getMessagesAvailable()

template<typename T >
FwSizeType Os::QueueCommon< T >::getMessagesAvailable ( ) const

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

Definition at line 302 of file Queue.hpp.

◆ getMessageSize()

template<typename T >
FwSizeType Os::QueueCommon< T >::getMessageSize ( ) const

get the queue's message maximum size

Definition at line 347 of file Queue.hpp.

◆ getName()

template<typename T >
const QueueString & Os::QueueCommon< T >::getName ( ) const

get the queue's name

Definition at line 352 of file Queue.hpp.

◆ getNumQueues()

template<typename T >
FwSizeType Os::QueueCommon< T >::getNumQueues ( )
static

get number of queues system-wide

Definition at line 357 of file Queue.hpp.

◆ getStaticMutex()

template<typename T >
Os::Mutex & Os::QueueCommon< T >::getStaticMutex ( )
static

get static mutex

Definition at line 363 of file Queue.hpp.

◆ operator=()

template<typename T >
QueueCommon& Os::QueueCommon< T >::operator= ( const QueueCommon< T > &  other)
delete

assignment operator is forbidden

◆ receive() [1/2]

template<typename T >
QueueUserInterface::Status Os::QueueCommon< T >::receive ( U8 *  destination,
FwSizeType  capacity,
QueueUserInterface::BlockingType  blockType,
FwSizeType &  actualSize,
FwQueuePriorityType &  priority 
)

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

Definition at line 284 of file Queue.hpp.

◆ receive() [2/2]

template<typename T >
QueueUserInterface::Status Os::QueueCommon< T >::receive ( Fw::LinearBufferBase &  destination,
QueueUserInterface::BlockingType  blockType,
FwQueuePriorityType &  priority 
)

receive a message from a queue

Receive a message from a queue with the given block type. See: QueueUserInterface::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

Definition at line 324 of file Queue.hpp.

◆ send() [1/2]

template<typename T >
QueueUserInterface::Status Os::QueueCommon< T >::send ( const U8 *  buffer,
FwSizeType  size,
FwQueuePriorityType  priority,
QueueUserInterface::BlockingType  blockType 
)

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

Definition at line 267 of file Queue.hpp.

◆ send() [2/2]

template<typename T >
QueueUserInterface::Status Os::QueueCommon< T >::send ( const Fw::LinearBufferBase &  message,
FwQueuePriorityType  priority,
QueueUserInterface::BlockingType  blockType 
)

send a message to a queue

Send a message to a queue with the given priority and block type. See: QueueUserInterface::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

Definition at line 317 of file Queue.hpp.

◆ teardown()

template<typename T >
void Os::QueueCommon< T >::teardown ( )

teardown the queue

Allow for queues to deallocate resources as part of system shutdown. This delegates to the underlying queue implementation. implementation.

Definition at line 262 of file Queue.hpp.


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