| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
erpc::StaticQueue< T, elementCount > Class Template Reference
Infrastructure » Utilities

Template class which implements static queue as ring buffer. More...

`#include <erpc_static_queue.h>`

## Public Member Functions
| StaticQueue (void)
| Constructor of StaticQueue class. More...
| ~StaticQueue (void)
| Destructor of StaticQueue class. More...
bool | add (T element)
| This function adds element to queue. More...
bool | get (T *element)
| This function returns element from queue. More...
int | size (void)
| This function returns number of elements in queue. More...

## Protected Attributes
uint64_t | m_storage [elementCount][(sizeof(T)+sizeof(uint64_t)-1)/sizeof(uint64_t)]
uint32_t | m_capacity
uint32_t volatile | m_head
uint32_t volatile | m_tail

## Detailed Description

### template<class T, uint32_t elementCount>
class erpc::StaticQueue< T, elementCount >

Template class which implements static queue as ring buffer.

## Constructor & Destructor Documentation

template<class T, uint32_t elementCount>

erpc::StaticQueue< T, elementCount >::StaticQueue | ( | void |  | ) |
| inline

Constructor of StaticQueue class.

This function sets capacity of queue, m_head and m_tail indexes to zero.

template<class T, uint32_t elementCount>

erpc::StaticQueue< T, elementCount >::~StaticQueue | ( | void |  | ) |
| inline

Destructor of StaticQueue class.

This function free allocated buffer for m_data.

## Member Function Documentation

template<class T, uint32_t elementCount>

bool erpc::StaticQueue< T, elementCount >::add | ( | T | element | ) |
| inline

This function adds element to queue.

Parameters

  [in] | element | Element for adding.

Return values

  true | Element was added.
  false | Element was not added, queue is full.

template<class T, uint32_t elementCount>

bool erpc::StaticQueue< T, elementCount >::get | ( | T * | element | ) |
| inline

This function returns element from queue.

Parameters

  [out] | element | Pointer to element to which will be copied element from queue.

Return values

  true | Element was copied from queue.
  false | Element was not copied, queue is empty.

template<class T, uint32_t elementCount>

int erpc::StaticQueue< T, elementCount >::size | ( | void |  | ) |
| inline

This function returns number of elements in queue.

Returns
  Number of elements in queue.

## Member Data Documentation

template<class T, uint32_t elementCount>

uint64_t erpc::StaticQueue< T, elementCount >::m_storage[elementCount][(sizeof(T)+sizeof(uint64_t)-1)/sizeof(uint64_t)]
| protected

Preallocated space based on data type size and elements count.

template<class T, uint32_t elementCount>

uint32_t erpc::StaticQueue< T, elementCount >::m_capacity
| protected

Capacity of queue

template<class T, uint32_t elementCount>

uint32_t volatile erpc::StaticQueue< T, elementCount >::m_head
| protected

Index to free slot

template<class T, uint32_t elementCount>

uint32_t volatile erpc::StaticQueue< T, elementCount >::m_tail
| protected

Index to slot with m_data

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

- erpc_static_queue.h