RC5 Demo
Public Member Functions | Private Attributes | List of all members
BitBuffer< BASETYPE, MAXBITS > Class Template Reference

#include <bitbuffer.h>

Public Member Functions

 BitBuffer (void)
 
void clear (void)
 
bool add (Bit bit)
 
bool isFull (void) const
 
bool isEmpty (void) const
 
BASETYPE get (void) const
 

Private Attributes

BASETYPE m_buffer
 Internal buffer to hold bits. More...
 
uint8_t m_numBits
 Current number of bits in buffer. More...
 

Detailed Description

template<typename BASETYPE, uint8_t MAXBITS>
class BitBuffer< BASETYPE, MAXBITS >

Template class to store a series of bits.

Parameters
BASETYPEInteger base type to use as internal buffer
MAXBITSMaximum number of bits to store

Constructor & Destructor Documentation

◆ BitBuffer()

template<typename BASETYPE, uint8_t MAXBITS>
BitBuffer< BASETYPE, MAXBITS >::BitBuffer ( void  )
inline

Member Function Documentation

◆ add()

template<typename BASETYPE, uint8_t MAXBITS>
bool BitBuffer< BASETYPE, MAXBITS >::add ( Bit  bit)
inline

Adds a bit to the least significant position, shifting existing bits to the left.

Note
When full, new bits are silently discarded.
Parameters
[in]bitBit to add
Returns
True if bit was added, false if buffer is full.

◆ clear()

template<typename BASETYPE, uint8_t MAXBITS>
void BitBuffer< BASETYPE, MAXBITS >::clear ( void  )
inline

Clears the internal buffer.

◆ get()

template<typename BASETYPE, uint8_t MAXBITS>
BASETYPE BitBuffer< BASETYPE, MAXBITS >::get ( void  ) const
inline

Gets the content of the internal buffer.

◆ isEmpty()

template<typename BASETYPE, uint8_t MAXBITS>
bool BitBuffer< BASETYPE, MAXBITS >::isEmpty ( void  ) const
inline

Returns true if buffer is empty.

Returns
True if buffer is empty, false otherwise.

◆ isFull()

template<typename BASETYPE, uint8_t MAXBITS>
bool BitBuffer< BASETYPE, MAXBITS >::isFull ( void  ) const
inline

Returns true if buffer is full.

Returns
True if buffer is full, false otherwise.

Member Data Documentation

◆ m_buffer

template<typename BASETYPE, uint8_t MAXBITS>
BASETYPE BitBuffer< BASETYPE, MAXBITS >::m_buffer
private

Internal buffer to hold bits.

◆ m_numBits

template<typename BASETYPE, uint8_t MAXBITS>
uint8_t BitBuffer< BASETYPE, MAXBITS >::m_numBits
private

Current number of bits in buffer.


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