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

A generic buffer queue data structure. More...

#include <Os/Pthreads/BufferQueue.hpp>

Public Member Functions

 BufferQueue ()
 BufferQueue constructor. More...
 
 ~BufferQueue ()
 BufferQueue deconstructor. More...
 
bool create (NATIVE_UINT_TYPE depth, NATIVE_UINT_TYPE msgSize)
 BufferQueue creation. More...
 
bool push (const U8 *buffer, NATIVE_UINT_TYPE size, NATIVE_INT_TYPE priority)
 push an item onto the queue More...
 
bool pop (U8 *buffer, NATIVE_UINT_TYPE &size, NATIVE_INT_TYPE &priority)
 pop an item off the queue More...
 
bool isFull ()
 check if the queue is full More...
 
bool isEmpty ()
 check if the queue is empty More...
 
NATIVE_UINT_TYPE getCount ()
 Get the current number of items on the queue. More...
 
NATIVE_UINT_TYPE getMaxCount ()
 Get the maximum number of items seen on the queue. More...
 
NATIVE_UINT_TYPE getMsgSize ()
 Get the maximum message size. More...
 
NATIVE_UINT_TYPE getDepth ()
 Get the queue depths. More...
 

Detailed Description

A generic buffer queue data structure.

This is a generic queue interface that can be implemented using a variety of different data structures

Definition at line 26 of file BufferQueue.hpp.

Constructor & Destructor Documentation

◆ BufferQueue()

Os::BufferQueue::BufferQueue ( )

BufferQueue constructor.

Create a BufferQueue object.

Definition at line 25 of file BufferQueueCommon.cpp.

◆ ~BufferQueue()

Os::BufferQueue::~BufferQueue ( )

BufferQueue deconstructor.

Deallocate the queue.

Definition at line 34 of file BufferQueueCommon.cpp.

Member Function Documentation

◆ create()

bool Os::BufferQueue::create ( NATIVE_UINT_TYPE  depth,
NATIVE_UINT_TYPE  msgSize 
)

BufferQueue creation.

Create a queue with buffer allocated at initialization. Messages will have a maximum size "msgSize" and the buffer with be "depth" elements deep.

Parameters
depththe maximum number of buffers to store on queue
msgSizethe maximum size of a buffer that can be stored on the queue

Definition at line 38 of file BufferQueueCommon.cpp.

◆ getCount()

NATIVE_UINT_TYPE Os::BufferQueue::getCount ( )

Get the current number of items on the queue.

Get the number of items on the queue.

Definition at line 99 of file BufferQueueCommon.cpp.

◆ getDepth()

NATIVE_UINT_TYPE Os::BufferQueue::getDepth ( )

Get the queue depths.

Get the maximum number of messages allowed on the queue

Definition at line 112 of file BufferQueueCommon.cpp.

◆ getMaxCount()

NATIVE_UINT_TYPE Os::BufferQueue::getMaxCount ( )

Get the maximum number of items seen on the queue.

Get the maximum number of items that have been on the queue since the instantiation of the queue. This is a "high water mark" count.

Definition at line 103 of file BufferQueueCommon.cpp.

◆ getMsgSize()

NATIVE_UINT_TYPE Os::BufferQueue::getMsgSize ( )

Get the maximum message size.

Get the maximum message size allowed on the queue

Definition at line 108 of file BufferQueueCommon.cpp.

◆ isEmpty()

bool Os::BufferQueue::isEmpty ( )

check if the queue is empty

Is the queue empty?

Definition at line 95 of file BufferQueueCommon.cpp.

◆ isFull()

bool Os::BufferQueue::isFull ( )

check if the queue is full

Is the queue full?

Definition at line 91 of file BufferQueueCommon.cpp.

◆ pop()

bool Os::BufferQueue::pop ( U8 buffer,
NATIVE_UINT_TYPE size,
NATIVE_INT_TYPE priority 
)

pop an item off the queue

Pull an item off of the queue and put it in "buffer" which is of size "size". Returns the size of the pulled item in "size" and the priority of the pulled item in "priority" on a success.

Parameters
bufferthe buffer to fill from the queue
sizethe size of buffer. The size of the popped buffer will also be returned in this variable. It is used as both input and output
prioritythe priority of the buffer popped off the queue

Definition at line 72 of file BufferQueueCommon.cpp.

◆ push()

bool Os::BufferQueue::push ( const U8 buffer,
NATIVE_UINT_TYPE  size,
NATIVE_INT_TYPE  priority 
)

push an item onto the queue

Push an item onto the queue with the specified size and priority

Parameters
bufferthe buffer to push onto the queue
sizethe size of buffer
prioritythe priority of the buffer on the queue (higher priority means that the buffer will be popped off sooner.

Definition at line 51 of file BufferQueueCommon.cpp.


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