eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc::StaticQueue< T, elementCount > Class Template Reference

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

#include <erpc_static_queue.hpp>

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...
 
uint32_t size (void)
 This function returns number of elements in queue. More...
 

Protected Attributes

uint64_t m_storage [elementCount][(sizeof(T)+sizeof(uint64_t)-1U)/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 ( element)
inline

This function adds element to queue.

Parameters
[in]elementElement for adding.
Return values
trueElement was added.
falseElement 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]elementPointer to element to which will be copied element from queue.
Return values
trueElement was copied from queue.
falseElement was not copied, queue is empty.
template<class T, uint32_t elementCount>
uint32_t 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)-1U)/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: