Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
RingBufCPP< Type, MaxElements > Class Template Reference

Public Member Functions

bool add (const Type &obj)
 
bool pull (Type *dest)
 
Type * peek (size_t num)
 
bool isFull () const
 
size_t numElements () const
 
bool isEmpty () const
 

Protected Member Functions

size_t getTail () const
 

Protected Attributes

Type _buf [MaxElements]
 
size_t _head
 
size_t _numElements
 

Member Function Documentation

template<typename Type, size_t MaxElements>
bool RingBufCPP< Type, MaxElements >::add ( const Type &  obj)
inline

Add element obj to the buffer Return: true on success

template<typename Type, size_t MaxElements>
size_t RingBufCPP< Type, MaxElements >::getTail ( ) const
inlineprotected

Calculates the index in the array of the oldest element Return: index in array of element

template<typename Type, size_t MaxElements>
bool RingBufCPP< Type, MaxElements >::isEmpty ( ) const
inline

Return: true if buffer is empty

template<typename Type, size_t MaxElements>
bool RingBufCPP< Type, MaxElements >::isFull ( ) const
inline

Return: true if buffer is full

template<typename Type, size_t MaxElements>
size_t RingBufCPP< Type, MaxElements >::numElements ( ) const
inline

Return: number of elements in buffer

template<typename Type, size_t MaxElements>
Type* RingBufCPP< Type, MaxElements >::peek ( size_t  num)
inline

Peek at num'th element in the buffer Return: a pointer to the num'th element

template<typename Type, size_t MaxElements>
bool RingBufCPP< Type, MaxElements >::pull ( Type *  dest)
inline

Remove last element from buffer, and copy it to dest Return: true on success