FreeRTOScpp
FreeRTOScpp::Queue< T, queueLength > Class Template Reference

Queue Wrapper. More...

#include <QueueCPP.h>

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

Public Member Functions

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

Protected Attributes

QueueHandle_t queueHandle
 

Detailed Description

template<class T, unsigned queueLength>
class FreeRTOScpp::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>
FreeRTOScpp::Queue< T, queueLength >::Queue ( char const *  name = 0)
inline

Constructor.

Parameters
nameThe name to register the Queue with.

References FreeRTOScpp::QueueBase::queueHandle.

Member Function Documentation

◆ add() [1/2]

template<class T >
bool FreeRTOScpp::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

References FreeRTOScpp::QueueBase::queueHandle.

◆ add() [2/2]

template<class T >
bool FreeRTOScpp::QueueTypeBase< T >::add ( T const &  item,
Time_ms  time 
)
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

References FreeRTOScpp::ms2ticks(), and FreeRTOScpp::QueueBase::queueHandle.

Here is the call graph for this function:

◆ add_ISR()

template<class T >
bool FreeRTOScpp::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

References FreeRTOScpp::QueueBase::queueHandle.

◆ available()

unsigned FreeRTOScpp::QueueBase::available ( ) const
inlineinherited

Return number of spaces available in Queue.

Returns
the number of spaces available in the Queue.

References FreeRTOScpp::QueueBase::queueHandle.

◆ empty()

bool FreeRTOScpp::QueueBase::empty ( )
inlineinherited

Check if Queue is Empty.

Returns
True if Queue is Empty.

References FreeRTOScpp::QueueBase::queueHandle.

◆ empty_ISR()

bool FreeRTOScpp::QueueBase::empty_ISR ( )
inlineinherited

Is Queue Empty.

Note: Interrupt service routines should only call _ISR routines.

Returns
True if Queue is Empty.

References FreeRTOScpp::QueueBase::queueHandle.

◆ full()

bool FreeRTOScpp::QueueBase::full ( )
inlineinherited

Check if Queue is Full.

Returns
True if Queue is Full.

References FreeRTOScpp::QueueBase::queueHandle.

◆ full_ISR()

bool FreeRTOScpp::QueueBase::full_ISR ( )
inlineinherited

Is Queue Full.

Note: Interrupt service routines should only call _ISR routines.

Returns
True if Queue is Full.

References FreeRTOScpp::QueueBase::queueHandle.

◆ peek() [1/2]

template<class T >
bool FreeRTOScpp::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.

References FreeRTOScpp::QueueBase::queueHandle.

◆ peek() [2/2]

template<class T >
bool FreeRTOScpp::QueueTypeBase< T >::peek ( T &  var,
Time_ms  time 
)
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.

References FreeRTOScpp::ms2ticks(), and FreeRTOScpp::QueueBase::queueHandle.

Here is the call graph for this function:

◆ peek_ISR()

template<class T >
bool FreeRTOScpp::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.

References FreeRTOScpp::QueueBase::queueHandle.

◆ pop() [1/2]

template<class T >
bool FreeRTOScpp::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.

References FreeRTOScpp::QueueBase::queueHandle.

◆ pop() [2/2]

template<class T >
bool FreeRTOScpp::QueueTypeBase< T >::pop ( T &  var,
Time_ms  time 
)
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.

References FreeRTOScpp::ms2ticks(), and FreeRTOScpp::QueueBase::queueHandle.

Here is the call graph for this function:

◆ pop_ISR()

template<class T >
bool FreeRTOScpp::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.

References FreeRTOScpp::QueueBase::queueHandle.

◆ push() [1/2]

template<class T >
bool FreeRTOScpp::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

References FreeRTOScpp::QueueBase::queueHandle.

◆ push() [2/2]

template<class T >
bool FreeRTOScpp::QueueTypeBase< T >::push ( T const &  item,
Time_ms  time 
)
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

References FreeRTOScpp::ms2ticks(), and FreeRTOScpp::QueueBase::queueHandle.

Here is the call graph for this function:

◆ push_ISR()

template<class T >
bool FreeRTOScpp::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

References FreeRTOScpp::QueueBase::queueHandle.

◆ reset()

void FreeRTOScpp::QueueBase::reset ( )
inlineinherited

Reset the Queue.

Resets the Queue to an empty state.

References FreeRTOScpp::QueueBase::queueHandle.

◆ waiting()

unsigned FreeRTOScpp::QueueBase::waiting ( ) const
inlineinherited

Get number of items in the Queue.

Returns
The number of item in the Queue.

References FreeRTOScpp::QueueBase::queueHandle.

◆ waiting_ISR()

unsigned FreeRTOScpp::QueueBase::waiting_ISR ( )
inlineinherited

Get number of message waiting.

Note: Interrupt service routines should only call _ISR routines.

Returns
The number of messages waiting.

References FreeRTOScpp::QueueBase::queueHandle.

Member Data Documentation

◆ queueHandle


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