FreeRTOS Addons
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cpp_freertos::Queue Class Reference

#include <queue.hpp>

Inheritance diagram for cpp_freertos::Queue:
cpp_freertos::BinaryQueue cpp_freertos::Deque

Public Member Functions

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

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.

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.

◆ ~Queue()

Queue::~Queue ( )
virtual

Our destructor.

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.

◆ 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.

◆ Enqueue() [1/2]

bool Queue::Enqueue ( const 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.

◆ Enqueue() [2/2]

bool Queue::Enqueue ( const 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.

◆ EnqueueFromISR()

bool Queue::EnqueueFromISR ( const 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.

◆ Flush()

void Queue::Flush ( )

Remove all objects from the queue.

◆ 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.

◆ 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.

◆ NumItems()

UBaseType_t Queue::NumItems ( )

How many items are currently in the queue.

Returns
the number of items in the queue.

◆ NumSpacesLeft()

UBaseType_t Queue::NumSpacesLeft ( )

How many empty spaves are currently left in the queue.

Returns
the number of remaining spaces.

◆ 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.

◆ 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.

Member Data Documentation

◆ handle

QueueHandle_t cpp_freertos::Queue::handle
protected

FreeRTOS queue handle.


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