F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
base queue interface More...
#include <Os/Queue.hpp>
Public Types | |
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... | |
Public Member Functions | |
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... | |
virtual QueueInterface & | operator= (const QueueInterface &other)=delete |
assignment operator is forbidden More... | |
virtual Status | create (const Fw::StringBase &name, FwSizeType depth, FwSizeType messageSize)=0 |
create queue storage More... | |
virtual Status | send (const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType)=0 |
send a message into the queue More... | |
virtual Status | receive (U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority)=0 |
receive a message from the queue More... | |
virtual FwSizeType | getMessagesAvailable () const =0 |
get number of messages available More... | |
virtual FwSizeType | getMessageHighWaterMark () const =0 |
get maximum messages stored at any given time More... | |
virtual QueueHandle * | getHandle ()=0 |
return the underlying queue handle (implementation specific) More... | |
Static Public Member Functions | |
static QueueInterface * | getDelegate (QueueHandleStorage &aligned_placement_new_memory) |
provide a pointer to a queue delegate object More... | |
base queue interface
Queues are used internally to fprime in order to support the messaging between components. The QueueInterface is used to abstract away from the standard OS-based queue, allowing F prime support multiple OSes in a consistent way.
status returned from the queue send function
Enumerator | |
---|---|
OP_OK | message sent/received okay |
ALREADY_CREATED | creating an already created queue |
EMPTY | If non-blocking, all the messages have been drained. |
UNINITIALIZED | Queue wasn't initialized successfully. |
SIZE_MISMATCH | attempted to send or receive with buffer too large, too small |
SEND_ERROR | message send error |
RECEIVE_ERROR | message receive error |
INVALID_PRIORITY | invalid priority requested |
FULL | queue was full when attempting to send a message |
UNKNOWN_ERROR | Unexpected error; can't match with returns. |
|
default |
default queue interface constructor
|
virtualdefault |
default queue destructor
|
delete |
copy constructor is forbidden
|
delete |
copy constructor is forbidden
|
pure virtual |
create queue storage
Creates a queue ensuring sufficient storage to hold depth
messages of messageSize
size each. Resource allocation is dependent on the underlying implementation and users should assume that resource allocation is possible.
name | name of queue |
depth | depth of queue in number of messages |
messageSize | size of an individual message |
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
static |
provide a pointer to a queue delegate object
This function must return a pointer to a QueueInterface
object that contains the real implementation of the queue functions as defined by the implementor. This function must do several things to be considered correctly implemented:
FW_ASSERT(aligned_placement_new_memory != NULL);
static_assert(sizeof(PosixQueueImplementation) <= sizeof Os::Queue::m_handle_storage, "FW_HANDLE_MAX_SIZE to small");
static_assert((FW_HANDLE_ALIGNMENT % alignof(PosixQueueImplementation)) == 0, "Bad handle alignment");
aligned_placement_new_memory
e.g. TaskInterface* interface = new (aligned_placement_new_memory) PosixQueueImplementation;
return interface;
aligned_placement_new_memory
Definition at line 10 of file DefaultPriorityQueue.cpp.
|
pure virtual |
return the underlying queue handle (implementation specific)
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
pure virtual |
get maximum messages stored at any given time
Returns the maximum number of messages in this queue at any given time. This is the high-water mark for this queue.
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
pure virtual |
get number of messages available
Returns the number of messages currently available in the queue.
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
virtualdelete |
assignment operator is forbidden
Reimplemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
pure virtual |
receive a message from the queue
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.
It is invalid to send a null buffer. This method will block if the queue is empty and blockType is set to BLOCKING
destination | destination for message data |
capacity | maximum size of message data |
blockType | BLOCKING 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 |
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.
|
pure virtual |
send a message into the queue
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.
It is invalid to send a null buffer. This method will block if the queue is full and blockType is set to BLOCKING
buffer | message data |
size | size of message data |
priority | priority of the message |
blockType | BLOCKING to block for space or NONBLOCKING to return error when queue is full |
Implemented in Os::Stub::Queue::StubQueue, Os::Queue, and Os::Generic::PriorityQueue.