FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | Protected Attributes | List of all members
cpp_freertos::Queue Class Reference

#include <queue.hpp>

Inheritance diagram for cpp_freertos::Queue:
Inheritance graph
[legend]

Public Member Functions

 Queue (UBaseType_t maxItems, UBaseType_t itemSize)
 
virtual ~Queue ()
 
virtual bool Enqueue (void *item)
 
virtual bool Enqueue (void *item, TickType_t Timeout)
 
bool Dequeue (void *item, TickType_t Timeout=portMAX_DELAY)
 
bool Peek (void *item, TickType_t Timeout=portMAX_DELAY)
 
virtual bool EnqueueFromISR (void *item, BaseType_t *pxHigherPriorityTaskWoken)
 
bool DequeueFromISR (void *item, BaseType_t *pxHigherPriorityTaskWoken)
 
bool PeekFromISR (void *item)
 
bool IsEmpty ()
 
bool IsFull ()
 
void Flush ()
 
UBaseType_t NumItems ()
 
UBaseType_t NumSpacesLeft ()
 

Protected Attributes

QueueHandle_t handle
 

Detailed Description

Queue class wrapper for FreeRTOS queues. This class provides enqueue and dequeue operations.

Note
It is expected that an application will instantiate this class or one of the derived classes and use that. It is not expected that a user or application will derive from these classes.

Definition at line 115 of file queue.hpp.

Constructor & Destructor Documentation

◆ Queue()

Queue::Queue ( UBaseType_t  maxItems,
UBaseType_t  itemSize 
)

Our constructor.

Exceptions
QueueCreateException
Parameters
maxItemsMaximum number of items this queue can hold.
itemSizeSize of an item in a queue.
Note
FreeRTOS queues use a memcpy / fixed size scheme for queues.

Definition at line 46 of file cqueue.cpp.

◆ ~Queue()

Queue::~Queue ( )
virtual

Our destructor.

Definition at line 60 of file cqueue.cpp.

Member Function Documentation

◆ Dequeue()

bool Queue::Dequeue ( void *  item,
TickType_t  Timeout = portMAX_DELAY 
)

Remove an item from the front of the queue.

Parameters
itemWhere the item you are removing will be returned to.
TimeoutHow long to wait to remove an item if the queue is currently empty.
Returns
true if an item was removed, false if no item was removed.

Definition at line 86 of file cqueue.cpp.

◆ DequeueFromISR()

bool Queue::DequeueFromISR ( void *  item,
BaseType_t *  pxHigherPriorityTaskWoken 
)

Remove an item from the front of the queue in ISR context.

Parameters
itemWhere the item you are removing will be returned to.
pxHigherPriorityTaskWokenDid this operation result in a rescheduling event.
Returns
true if an item was removed, false if no item was removed.

Definition at line 116 of file cqueue.cpp.

◆ Enqueue() [1/2]

bool Queue::Enqueue ( void *  item)
virtual

Add an item to the back of the queue.

Parameters
itemThe item you are adding.
Returns
true if the item was added, false if it was not.

Reimplemented in cpp_freertos::BinaryQueue.

Definition at line 66 of file cqueue.cpp.

◆ Enqueue() [2/2]

bool Queue::Enqueue ( void *  item,
TickType_t  Timeout 
)
virtual

Add an item to the back of the queue.

Parameters
itemThe item you are adding.
TimeoutHow long to wait to add the item to the queue if the queue is currently full.
Returns
true if the item was added, false if it was not.

Definition at line 76 of file cqueue.cpp.

◆ EnqueueFromISR()

bool Queue::EnqueueFromISR ( void *  item,
BaseType_t *  pxHigherPriorityTaskWoken 
)
virtual

Add an item to the back of the queue in ISR context.

Parameters
itemThe item you are adding.
pxHigherPriorityTaskWokenDid this operation result in a rescheduling event.
Returns
true if the item was added, false if it was not.

Reimplemented in cpp_freertos::BinaryQueue.

Definition at line 106 of file cqueue.cpp.

◆ Flush()

void Queue::Flush ( )

Remove all objects from the queue.

Definition at line 152 of file cqueue.cpp.

◆ IsEmpty()

bool Queue::IsEmpty ( )

Is the queue empty?

Returns
true if the queue was empty when this was called, false if the queue was not empty.

Definition at line 136 of file cqueue.cpp.

◆ IsFull()

bool Queue::IsFull ( )

Is the queue full?

Returns
true if the queue was full when this was called, false if the queue was not full.

Definition at line 144 of file cqueue.cpp.

◆ NumItems()

UBaseType_t Queue::NumItems ( )

How many items are currently in the queue.

Returns
the number of items in the queue.

Definition at line 158 of file cqueue.cpp.

◆ NumSpacesLeft()

UBaseType_t Queue::NumSpacesLeft ( )

How many empty spaves are currently left in the queue.

Returns
the number of remaining spaces.

Definition at line 164 of file cqueue.cpp.

◆ Peek()

bool Queue::Peek ( void *  item,
TickType_t  Timeout = portMAX_DELAY 
)

Make a copy of an item from the front of the queue. This will not remove it from the head of the queue.

Parameters
itemWhere the item you are removing will be returned to.
TimeoutHow long to wait to remove an item if the queue is currently empty.
Returns
true if an item was copied, false if no item was copied.

Definition at line 96 of file cqueue.cpp.

◆ PeekFromISR()

bool Queue::PeekFromISR ( void *  item)

Make a copy of an item from the front of the queue. This will not remove it from the head of the queue.

Parameters
itemWhere the item you are removing will be returned to.
Returns
true if an item was copied, false if no item was copied.

Definition at line 126 of file cqueue.cpp.

Member Data Documentation

◆ handle

QueueHandle_t cpp_freertos::Queue::handle
protected

FreeRTOS queue handle.

Definition at line 247 of file queue.hpp.


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