mn::queue::basic_queue Class Reference
Queue class wrapper for FreeRTOS queues. More...
#include <mn_queue.hpp>
Inheritance diagram for mn::queue::basic_queue:
Public Member Functions | |
basic_queue (unsigned int maxItems, unsigned int itemSize) | |
virtual | ~basic_queue () |
virtual int | create () |
virtual int | destroy () |
virtual int | enqueue (void *item, unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_QUEUE_DEFAULT) |
virtual int | peek (void *item, unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_QUEUE_DEFAULT) |
virtual int | dequeue (void *item, unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_QUEUE_DEFAULT) |
virtual bool | is_empty () |
virtual bool | is_full () |
virtual int | clear () |
virtual unsigned int | get_num_items () |
virtual unsigned int | get_left () |
void * | get_handle () |
Protected Attributes | |
void * | m_pHandle |
unsigned int | m_imaxItems |
unsigned int | m_iitemSize |
Detailed Description
Queue class wrapper for FreeRTOS queues.
- Note
- can use at the ISR Context, too. This wrapper switch automatic
Constructor & Destructor Documentation
◆ basic_queue()
mn::queue::basic_queue::basic_queue | ( | unsigned int | maxItems, |
unsigned int | itemSize | ||
) |
ctor
- Parameters
-
maxItems Maximum number of items this queue can hold. itemSize Size of an item in a queue.
◆ ~basic_queue()
|
virtual |
dtor
Member Function Documentation
◆ clear()
|
virtual |
Remove all objects from the queue.
◆ create()
|
virtual |
Create the queue
- Returns
- 'ERR_QUEUE_OK': the queue was created 'ERR_QUEUE_ALREADYINIT': the queue is allready created 'ERR_QUEUE_CANTCREATE': queue can not created
- Note
- FreeRTOS queues use a memcpy / fixed size scheme for queues.
◆ dequeue()
|
virtual |
Remove an item from the front of the queue.
- Parameters
-
item Where the item you are removing will be returned to. timeout How long to wait to remove an item to the queue.
- Returns
- 'ERR_QUEUE_OK' the item was removed, 'ERR_QUEUE_REMOVE' on an error and 'ERR_QUEUE_NOTCREATED' when the queue not created
◆ destroy()
|
virtual |
Destroy the Queue
- Returns
- 'ERR_QUEUE_OK' the queue was destroyed 'ERR_QUEUE_NOTCREATED' the queue is not created
◆ enqueue()
|
virtual |
Add an item to the back of the queue.
- Parameters
-
item The item you are adding. timeout How long to wait to add the item to the queue
- Returns
- 'ERR_QUEUE_OK' the item was added, 'ERR_QUEUE_ADD' on an error and 'ERR_QUEUE_NOTCREATED' when the queue not created
Reimplemented in mn::queue::basic_binaryqueue.
◆ get_handle()
|
inline |
get the FreeRTOS queue handle
- Returns
- the FreeRTOS handle
◆ get_left()
|
virtual |
How many empty spaves are currently left in the queue.
- Returns
- the number of remaining spaces.
◆ get_num_items()
|
virtual |
How many items are currently in the queue.
- Returns
- the number of items in the queue.
◆ is_empty()
|
virtual |
Is the queue empty?
- Returns
- true the queue is empty and false when not
◆ is_full()
|
virtual |
Is the queue full?
- Returns
- true the queue is full and false when not
◆ peek()
|
virtual |
Make a copy of an item from the front of the queue. This will not remove it
- Parameters
-
item Where the item you are getting will be returned to. timeout How long to wait
- Returns
- 'ERR_QUEUE_OK' if an item was copied, 'ERR_QUEUE_PEEK' on error and 'ERR_QUEUE_NOTCREATED' when the queue not created
Member Data Documentation
◆ m_iitemSize
|
protected |
◆ m_imaxItems
|
protected |
◆ m_pHandle
|
protected |
FreeRTOS queue handle.
The documentation for this class was generated from the following files: