Leosac  0.8.0
Open Source Access Control
Leosac::Module::Rpleth::CircularBuffer Class Reference

Implementation of a ring buffer. More...

#include <circularbuffer.hpp>

+ Collaboration diagram for Leosac::Module::Rpleth::CircularBuffer:

Public Member Functions

 CircularBuffer (std::size_t size=DefaultSize)
 
 ~CircularBuffer ()=default
 
std::size_t read (Byte *data, std::size_t size)
 
std::size_t write (const Byte *data, std::size_t size)
 
Byte operator[] (int idx) const
 
void fastForward (std::size_t offset)
 
void reset ()
 
std::size_t getSize () const
 
std::size_t toRead () const
 
bool isEmpty () const
 

Private Attributes

std::vector< Byte_buffer
 
std::size_t _size
 
std::size_t _rIdx
 
std::size_t _wIdx
 
std::size_t _toRead
 

Static Private Attributes

static const std::size_t DefaultSize = 8192
 

Detailed Description

Implementation of a ring buffer.

Definition at line 43 of file circularbuffer.hpp.

Constructor & Destructor Documentation

◆ CircularBuffer()

CircularBuffer::CircularBuffer ( std::size_t  size = DefaultSize)

Definition at line 32 of file circularbuffer.cpp.

◆ ~CircularBuffer()

Leosac::Module::Rpleth::CircularBuffer::~CircularBuffer ( )
default

Member Function Documentation

◆ fastForward()

void CircularBuffer::fastForward ( std::size_t  offset)

Definition at line 81 of file circularbuffer.cpp.

◆ getSize()

std::size_t CircularBuffer::getSize ( ) const

Definition at line 96 of file circularbuffer.cpp.

◆ isEmpty()

bool CircularBuffer::isEmpty ( ) const

Definition at line 106 of file circularbuffer.cpp.

◆ operator[]()

Byte CircularBuffer::operator[] ( int  idx) const

Definition at line 76 of file circularbuffer.cpp.

◆ read()

std::size_t CircularBuffer::read ( Byte data,
std::size_t  size 
)

Definition at line 41 of file circularbuffer.cpp.

◆ reset()

void CircularBuffer::reset ( )

Definition at line 89 of file circularbuffer.cpp.

◆ toRead()

std::size_t CircularBuffer::toRead ( ) const

Definition at line 101 of file circularbuffer.cpp.

◆ write()

std::size_t CircularBuffer::write ( const Byte data,
std::size_t  size 
)

Definition at line 61 of file circularbuffer.cpp.

Member Data Documentation

◆ _buffer

std::vector<Byte> Leosac::Module::Rpleth::CircularBuffer::_buffer
private

Definition at line 70 of file circularbuffer.hpp.

◆ _rIdx

std::size_t Leosac::Module::Rpleth::CircularBuffer::_rIdx
private

Definition at line 72 of file circularbuffer.hpp.

◆ _size

std::size_t Leosac::Module::Rpleth::CircularBuffer::_size
private

Definition at line 71 of file circularbuffer.hpp.

◆ _toRead

std::size_t Leosac::Module::Rpleth::CircularBuffer::_toRead
private

Definition at line 74 of file circularbuffer.hpp.

◆ _wIdx

std::size_t Leosac::Module::Rpleth::CircularBuffer::_wIdx
private

Definition at line 73 of file circularbuffer.hpp.

◆ DefaultSize

const std::size_t Leosac::Module::Rpleth::CircularBuffer::DefaultSize = 8192
staticprivate

Definition at line 45 of file circularbuffer.hpp.


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