MPD  0.20.6
Public Types | Public Member Functions | Protected Attributes
StaticFifoBuffer< T, size > Class Template Reference

A first-in-first-out buffer: you can append data at the end, and read data from the beginning. More...

#include <StaticFifoBuffer.hxx>

Public Types

typedef size_t size_type
 
typedef WritableBuffer< T > Range
 

Public Member Functions

constexpr StaticFifoBuffer ()
 
void Shift ()
 
void Clear ()
 
bool IsEmpty () const
 
bool IsFull () const
 
Range Write ()
 Prepares writing. More...
 
void Append (size_type n)
 Expands the tail of the buffer, after data has been written to the buffer returned by write(). More...
 
Range Read ()
 Return a buffer range which may be read. More...
 
void Consume (size_type n)
 Marks a chunk as consumed. More...
 

Protected Attributes

size_type head
 
size_type tail
 
data [size]
 

Detailed Description

template<class T, size_t size>
class StaticFifoBuffer< T, size >

A first-in-first-out buffer: you can append data at the end, and read data from the beginning.

This class automatically shifts the buffer as needed. It is not thread safe.

Definition at line 47 of file StaticFifoBuffer.hxx.

Member Typedef Documentation

template<class T, size_t size>
typedef WritableBuffer<T> StaticFifoBuffer< T, size >::Range

Definition at line 52 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
typedef size_t StaticFifoBuffer< T, size >::size_type

Definition at line 49 of file StaticFifoBuffer.hxx.

Constructor & Destructor Documentation

template<class T, size_t size>
constexpr StaticFifoBuffer< T, size >::StaticFifoBuffer ( )
inline

Definition at line 60 of file StaticFifoBuffer.hxx.

Member Function Documentation

template<class T, size_t size>
void StaticFifoBuffer< T, size >::Append ( size_type  n)
inline

Expands the tail of the buffer, after data has been written to the buffer returned by write().

Definition at line 105 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
void StaticFifoBuffer< T, size >::Clear ( )
inline

Definition at line 76 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
void StaticFifoBuffer< T, size >::Consume ( size_type  n)
inline

Marks a chunk as consumed.

Definition at line 124 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
bool StaticFifoBuffer< T, size >::IsEmpty ( ) const
inline

Definition at line 80 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
bool StaticFifoBuffer< T, size >::IsFull ( ) const
inline

Definition at line 84 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
Range StaticFifoBuffer< T, size >::Read ( )
inline

Return a buffer range which may be read.

The buffer pointer is writable, to allow modifications while parsing.

Definition at line 117 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
void StaticFifoBuffer< T, size >::Shift ( )
inline

Definition at line 62 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
Range StaticFifoBuffer< T, size >::Write ( )
inline

Prepares writing.

Returns a buffer range which may be written. When you are finished, call append().

Definition at line 92 of file StaticFifoBuffer.hxx.

Field Documentation

template<class T, size_t size>
T StaticFifoBuffer< T, size >::data[size]
protected

Definition at line 56 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
size_type StaticFifoBuffer< T, size >::head
protected

Definition at line 55 of file StaticFifoBuffer.hxx.

template<class T, size_t size>
size_type StaticFifoBuffer< T, size >::tail
protected

Definition at line 55 of file StaticFifoBuffer.hxx.


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