FreeRTOScpp
Loading...
Searching...
No Matches
Queue< T, queueLength > Class Template Reference

Queue Wrapper. More...

#include <QueueCPP.h>

Inheritance diagram for Queue< T, queueLength >:
Collaboration diagram for Queue< T, queueLength >:

Public Member Functions

 Queue (char const *name=0)
 Constructor.
 
bool add (T const &item, TickType_t time=portMAX_DELAY)
 add an item at end of the Queue.
 
bool add_ISR (T const &item, portBASE_TYPE &waswoken)
 add an item at end of the Queue.
 
unsigned available () const
 Return number of spaces available in Queue.
 
bool empty ()
 Check if Queue is Empty.
 
bool empty_ISR ()
 Is Queue Empty.
 
bool full ()
 Check if Queue is Full.
 
bool full_ISR ()
 Is Queue Full.
 
bool peek (T &var, TickType_t time=0)
 Look at the first item in the Queue.
 
bool peek_ISR (T &var, portBASE_TYPE &waswoken)
 Look at the first item in the Queue.
 
bool pop (T &var, TickType_t time=portMAX_DELAY)
 Get an item from the Queue.
 
bool pop_ISR (T &var, portBASE_TYPE &waswoken)
 Get an item from the Queue.
 
bool push (T const &item, TickType_t time=portMAX_DELAY)
 Push an item onto the Queue.
 
bool push_ISR (T const &item, portBASE_TYPE &waswoken)
 Push an item onto the Queue.
 
void reset ()
 Reset the Queue.
 
unsigned waiting () const
 Get number of items in the Queue.
 
unsigned waiting_ISR ()
 Get number of message waiting.
 

Protected Attributes

QueueHandle_t queueHandle
 

Detailed Description

template<class T, unsigned queueLength>
class Queue< T, queueLength >

Queue Wrapper.

Note, is a template on the type of object to place on the queue, which makes the Queue more typesafe.

Template Parameters
TThe type of object to be placed on the queue. Note also, this type needs to be trivially copyable, and preferably a POD as the FreeRTOS queue code will copy it with memcpy().
queuelengthThe number of elements to reserve space for in the queue. If 0 (which is the default value) then length will be provided to the constructor dynamically.
Todo

add Overwrite operation

add QueueSet Functionality

Constructor & Destructor Documentation

◆ Queue()

template<class T , unsigned queueLength>
Queue< T, queueLength >::Queue ( char const * name = 0)
inline

Constructor.

Parameters
nameThe name to register the Queue with.

Member Function Documentation

◆ add()

template<class T >
bool QueueTypeBase< T >::add ( T const & item,
TickType_t time = portMAX_DELAY )
inlineinherited

add an item at end of the Queue.

Puts an item onto the Queue so it will be the last item to remove.

Parameters
itemThe item to put on the Queue.
timeHow long to wait for room if Queue is full.
Returns
True if successful

◆ add_ISR()

template<class T >
bool QueueTypeBase< T >::add_ISR ( T const & item,
portBASE_TYPE & waswoken )
inlineinherited

add an item at end of the Queue.

Puts an item onto the Queue so it will be the last item to remove.

Note: Interrupt service routines should only call _ISR routines.

Parameters
itemThe item to put on the Queue.
waswokenFlag variable to determine if context switch is needed.
Returns
True if successful

◆ available()

unsigned QueueBase::available ( ) const
inlineinherited

Return number of spaces available in Queue.

Returns
the number of spaces available in the Queue.

◆ empty()

bool QueueBase::empty ( )
inlineinherited

Check if Queue is Empty.

Returns
True if Queue is Empty.

◆ empty_ISR()

bool QueueBase::empty_ISR ( )
inlineinherited

Is Queue Empty.

Note: Interrupt service routines should only call _ISR routines.

Returns
True if Queue is Empty.

◆ full()

bool QueueBase::full ( )
inlineinherited

Check if Queue is Full.

Returns
True if Queue is Full.

◆ full_ISR()

bool QueueBase::full_ISR ( )
inlineinherited

Is Queue Full.

Note: Interrupt service routines should only call _ISR routines.

Returns
True if Queue is Full.

◆ peek()

template<class T >
bool QueueTypeBase< T >::peek ( T & var,
TickType_t time = 0 )
inlineinherited

Look at the first item in the Queue.

Gets the first item from the Queue leaving it there.

Parameters
varVariable to place the item
timeHow long to wait for an item to be available.
Returns
True if an item returned.

◆ peek_ISR()

template<class T >
bool QueueTypeBase< T >::peek_ISR ( T & var,
portBASE_TYPE & waswoken )
inlineinherited

Look at the first item in the Queue.

Gets the first item from the Queue leaving it there.

Note: Interrupt service routines should only call _ISR routines.

Parameters
varVariable to place the item
waswokenFlag variable to determine if context switch is needed.
Returns
True if an item returned.

◆ pop()

template<class T >
bool QueueTypeBase< T >::pop ( T & var,
TickType_t time = portMAX_DELAY )
inlineinherited

Get an item from the Queue.

Gets the first item from the Queue

Parameters
varVariable to place the item
timeHow long to wait for an item to be available.
Returns
True if an item returned.

◆ pop_ISR()

template<class T >
bool QueueTypeBase< T >::pop_ISR ( T & var,
portBASE_TYPE & waswoken )
inlineinherited

Get an item from the Queue.

Gets the first item from the Queue

Note: Interrupt service routines should only call _ISR routines.

Parameters
varVariable to place the item
waswokenFlag variable to determine if context switch is needed.
Returns
True if an item returned.

◆ push()

template<class T >
bool QueueTypeBase< T >::push ( T const & item,
TickType_t time = portMAX_DELAY )
inlineinherited

Push an item onto the Queue.

Puts an item onto the Queue so it will be the next item to remove.

Parameters
itemThe item to put on the Queue.
timeHow long to wait for room if Queue is full.
Returns
True if successful

◆ push_ISR()

template<class T >
bool QueueTypeBase< T >::push_ISR ( T const & item,
portBASE_TYPE & waswoken )
inlineinherited

Push an item onto the Queue.

Puts an item onto the Queue so it will be the next item to remove.

Note: Interrupt service routines should only call _ISR routines.

Parameters
itemThe item to put on the Queue.
waswokenFlag variable to determine if context switch is needed.
Returns
True if successful

◆ reset()

void QueueBase::reset ( )
inlineinherited

Reset the Queue.

Resets the Queue to an empty state.

◆ waiting()

unsigned QueueBase::waiting ( ) const
inlineinherited

Get number of items in the Queue.

Returns
The number of item in the Queue.

◆ waiting_ISR()

unsigned QueueBase::waiting_ISR ( )
inlineinherited

Get number of message waiting.

Note: Interrupt service routines should only call _ISR routines.

Returns
The number of messages waiting.

Member Data Documentation

◆ queueHandle

QueueHandle_t QueueBase::queueHandle
protectedinherited

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