F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Os::Queue Class Reference

#include <Os/Queue.hpp>

Inheritance diagram for Os::Queue:
Os::IPCQueue

Public Types

enum  QueueStatus {
  QUEUE_OK, QUEUE_NO_MORE_MSGS, QUEUE_UNINITIALIZED, QUEUE_SIZE_MISMATCH,
  QUEUE_SEND_ERROR, QUEUE_RECEIVE_ERROR, QUEUE_INVALID_PRIORITY, QUEUE_EMPTY_BUFFER,
  QUEUE_FULL, QUEUE_UNKNOWN_ERROR
}
 
enum  QueueBlocking { QUEUE_BLOCKING, QUEUE_NONBLOCKING }
 

Public Member Functions

 Queue ()
 
virtual ~Queue ()
 
QueueStatus create (const Fw::StringBase &name, NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
 create a message queue More...
 
QueueStatus send (const Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE priority, QueueBlocking block)
 send a message More...
 
QueueStatus receive (Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE &priority, QueueBlocking block)
 receive a message More...
 
QueueStatus send (const U8 *buffer, NATIVE_INT_TYPE size, NATIVE_INT_TYPE priority, QueueBlocking block)
 send a message More...
 
QueueStatus receive (U8 *buffer, NATIVE_INT_TYPE capacity, NATIVE_INT_TYPE &actualSize, NATIVE_INT_TYPE &priority, QueueBlocking block)
 receive a message More...
 
NATIVE_INT_TYPE getNumMsgs (void) const
 get the number of messages in the queue More...
 
NATIVE_INT_TYPE getMaxMsgs (void) const
 get the maximum number of messages (high watermark) More...
 
NATIVE_INT_TYPE getQueueSize (void) const
 get the queue depth (maximum number of messages queue can hold) More...
 
NATIVE_INT_TYPE getMsgSize (void) const
 get the message size (maximum message size queue can hold) More...
 
const QueueStringgetName (void)
 get the queue name More...
 

Static Public Member Functions

static NATIVE_INT_TYPE getNumQueues (void)
 get the number of queues in the system More...
 

Protected Member Functions

QueueStatus createInternal (const Fw::StringBase &name, NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
 create a message queue More...
 

Protected Attributes

POINTER_CAST m_handle
 handle for implementation specific queue More...
 
QueueString m_name
 queue name More...
 

Static Protected Attributes

static NATIVE_INT_TYPE s_numQueues = 0
 tracks number of queues in the system More...
 

Detailed Description

Definition at line 24 of file Queue.hpp.

Member Enumeration Documentation

◆ QueueBlocking

Enumerator
QUEUE_BLOCKING 

Queue receive blocks until a message arrives.

QUEUE_NONBLOCKING 

Queue receive always returns even if there is no message.

Definition at line 40 of file Queue.hpp.

◆ QueueStatus

Enumerator
QUEUE_OK 

message sent/received okay

QUEUE_NO_MORE_MSGS 

If non-blocking, all the messages have been drained.

QUEUE_UNINITIALIZED 

Queue wasn't initialized successfully.

QUEUE_SIZE_MISMATCH 

attempted to send or receive with buffer too large, too small

QUEUE_SEND_ERROR 

message send error

QUEUE_RECEIVE_ERROR 

message receive error

QUEUE_INVALID_PRIORITY 

invalid priority requested

QUEUE_EMPTY_BUFFER 

supplied buffer is empty

QUEUE_FULL 

queue was full when attempting to send a message

QUEUE_UNKNOWN_ERROR 

Unexpected error; can't match with returns.

Definition at line 27 of file Queue.hpp.

Constructor & Destructor Documentation

◆ Queue()

Os::Queue::Queue ( )

Queue should be initialized with a NULL handle

Definition at line 39 of file Queue.cpp.

◆ ~Queue()

Os::Queue::~Queue ( )
virtual

Cleans up the dynamic memory of this queue

Definition at line 76 of file Queue.cpp.

Member Function Documentation

◆ create()

Queue::QueueStatus Os::Queue::create ( const Fw::StringBase name,
NATIVE_INT_TYPE  depth,
NATIVE_INT_TYPE  msgSize 
)

create a message queue

Definition at line 41 of file QueueCommon.cpp.

◆ createInternal()

Queue::QueueStatus Os::Queue::createInternal ( const Fw::StringBase name,
NATIVE_INT_TYPE  depth,
NATIVE_INT_TYPE  msgSize 
)
protected

create a message queue

Create a new queue. The will also recreate the queue if it exists. WARNING: this must be called only during initialization.

Parameters
constFw::StringBase &name: name of the queue
NATIVE_INT_TYPEdepth: depth of the queue
NATIVE_INT_TYPEmsgSize: message size
Returns
Queue::QueueStatus

Definition at line 51 of file Queue.cpp.

◆ getMaxMsgs()

NATIVE_INT_TYPE Os::Queue::getMaxMsgs ( void  ) const

get the maximum number of messages (high watermark)

Definition at line 238 of file Queue.cpp.

◆ getMsgSize()

NATIVE_INT_TYPE Os::Queue::getMsgSize ( void  ) const

get the message size (maximum message size queue can hold)

Definition at line 260 of file Queue.cpp.

◆ getName()

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

get the queue name

Definition at line 61 of file QueueCommon.cpp.

◆ getNumMsgs()

NATIVE_INT_TYPE Os::Queue::getNumMsgs ( void  ) const

get the number of messages in the queue

Definition at line 227 of file Queue.cpp.

◆ getNumQueues()

NATIVE_INT_TYPE Os::Queue::getNumQueues ( void  )
static

get the number of queues in the system

Definition at line 57 of file QueueCommon.cpp.

◆ getQueueSize()

NATIVE_INT_TYPE Os::Queue::getQueueSize ( void  ) const

get the queue depth (maximum number of messages queue can hold)

Definition at line 249 of file Queue.cpp.

◆ receive() [1/2]

Queue::QueueStatus Os::Queue::receive ( Fw::SerializeBufferBase buffer,
NATIVE_INT_TYPE priority,
QueueBlocking  block 
)

receive a message

Definition at line 22 of file QueueCommon.cpp.

◆ receive() [2/2]

Queue::QueueStatus Os::Queue::receive ( U8 buffer,
NATIVE_INT_TYPE  capacity,
NATIVE_INT_TYPE actualSize,
NATIVE_INT_TYPE priority,
QueueBlocking  block 
)

receive a message

Definition at line 209 of file Queue.cpp.

◆ send() [1/2]

Queue::QueueStatus Os::Queue::send ( const Fw::SerializeBufferBase buffer,
NATIVE_INT_TYPE  priority,
QueueBlocking  block 
)

send a message

Definition at line 13 of file QueueCommon.cpp.

◆ send() [2/2]

Queue::QueueStatus Os::Queue::send ( const U8 buffer,
NATIVE_INT_TYPE  size,
NATIVE_INT_TYPE  priority,
QueueBlocking  block 
)

send a message

Definition at line 120 of file Queue.cpp.

Member Data Documentation

◆ m_handle

POINTER_CAST Os::Queue::m_handle
protected

handle for implementation specific queue

Definition at line 69 of file Queue.hpp.

◆ m_name

QueueString Os::Queue::m_name
protected

queue name

Definition at line 70 of file Queue.hpp.

◆ s_numQueues

NATIVE_INT_TYPE Os::Queue::s_numQueues = 0
staticprotected

tracks number of queues in the system

Definition at line 74 of file Queue.hpp.


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