MPD  0.20.15
Public Types | Public Member Functions
DynamicFifoBuffer< T > Class Template Reference

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

#include <DynamicFifoBuffer.hxx>

Inheritance diagram for DynamicFifoBuffer< T >:
[legend]
Collaboration diagram for DynamicFifoBuffer< T >:
[legend]

Public Types

typedef ForeignFifoBuffer< T >::size_type size_type
 
typedef ForeignFifoBuffer< T >::pointer_type pointer_type
 
typedef ForeignFifoBuffer< T >::const_pointer_type const_pointer_type
 
typedef ForeignFifoBuffer< T >::Range Range
 

Public Member Functions

 DynamicFifoBuffer (size_type _capacity)
 
 ~DynamicFifoBuffer ()
 
 DynamicFifoBuffer (const DynamicFifoBuffer &)=delete
 
void Grow (size_type new_capacity)
 
void WantWrite (size_type n)
 
pointer_type Write (size_type n)
 Write data to the buffer, growing it as needed. More...
 
void Append (const_pointer_type p, size_type n)
 Append data to the buffer, growing it as needed. More...
 

Additional Inherited Members

- Protected Types inherited from ForeignFifoBuffer< T >
typedef size_t size_type
 
typedef WritableBuffer< T > Range
 
typedef Range::pointer_type pointer_type
 
typedef Range::const_pointer_type const_pointer_type
 
- Protected Member Functions inherited from ForeignFifoBuffer< T >
void Shift ()
 
constexpr ForeignFifoBuffer (std::nullptr_t n)
 
constexpr ForeignFifoBuffer (T *_data, size_type _capacity)
 
 ForeignFifoBuffer (ForeignFifoBuffer &&src)
 
ForeignFifoBufferoperator= (ForeignFifoBuffer &&src)
 
void Swap (ForeignFifoBuffer< T > &other)
 
constexpr bool IsNull () const
 
constexpr bool IsDefined () const
 
T * GetBuffer ()
 
constexpr size_type GetCapacity () const
 
void SetNull ()
 
void SetBuffer (T *_data, size_type _capacity)
 
void MoveBuffer (T *new_data, size_type new_capacity)
 
void Clear ()
 
constexpr bool IsEmpty () const
 
constexpr bool IsFull () const
 
Range Write ()
 Prepares writing. More...
 
bool WantWrite (size_type n)
 
void Append (size_type n)
 Expands the tail of the buffer, after data has been written to the buffer returned by write(). More...
 
constexpr size_type GetAvailable () const
 
constexpr Range Read () const
 Return a buffer range which may be read. More...
 
void Consume (size_type n)
 Marks a chunk as consumed. More...
 
size_type Read (pointer_type p, size_type n)
 
size_type MoveFrom (ForeignFifoBuffer< T > &src)
 Move as much data as possible from the specified buffer. More...
 
- Protected Attributes inherited from ForeignFifoBuffer< T >
size_type head
 
size_type tail
 
size_type capacity
 
T * data
 

Detailed Description

template<typename T>
class DynamicFifoBuffer< T >

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 41 of file DynamicFifoBuffer.hxx.

Member Typedef Documentation

◆ const_pointer_type

Definition at line 45 of file DynamicFifoBuffer.hxx.

◆ pointer_type

template<typename T>
typedef ForeignFifoBuffer<T>::pointer_type DynamicFifoBuffer< T >::pointer_type

Definition at line 44 of file DynamicFifoBuffer.hxx.

◆ Range

template<typename T>
typedef ForeignFifoBuffer<T>::Range DynamicFifoBuffer< T >::Range

Definition at line 46 of file DynamicFifoBuffer.hxx.

◆ size_type

template<typename T>
typedef ForeignFifoBuffer<T>::size_type DynamicFifoBuffer< T >::size_type

Definition at line 43 of file DynamicFifoBuffer.hxx.

Constructor & Destructor Documentation

◆ DynamicFifoBuffer() [1/2]

template<typename T>
DynamicFifoBuffer< T >::DynamicFifoBuffer ( size_type  _capacity)
inlineexplicit

Definition at line 48 of file DynamicFifoBuffer.hxx.

◆ ~DynamicFifoBuffer()

template<typename T>
DynamicFifoBuffer< T >::~DynamicFifoBuffer ( )
inline

Definition at line 50 of file DynamicFifoBuffer.hxx.

◆ DynamicFifoBuffer() [2/2]

template<typename T>
DynamicFifoBuffer< T >::DynamicFifoBuffer ( const DynamicFifoBuffer< T > &  )
delete

Member Function Documentation

◆ Append()

template<typename T>
void DynamicFifoBuffer< T >::Append ( const_pointer_type  p,
size_type  n 
)
inline

Append data to the buffer, growing it as needed.

Definition at line 102 of file DynamicFifoBuffer.hxx.

◆ Grow()

template<typename T>
void DynamicFifoBuffer< T >::Grow ( size_type  new_capacity)
inline

Definition at line 66 of file DynamicFifoBuffer.hxx.

◆ WantWrite()

template<typename T>
void DynamicFifoBuffer< T >::WantWrite ( size_type  n)
inline

Definition at line 75 of file DynamicFifoBuffer.hxx.

◆ Write()

template<typename T>
pointer_type DynamicFifoBuffer< T >::Write ( size_type  n)
inline

Write data to the buffer, growing it as needed.

Returns a writable pointer.

Definition at line 94 of file DynamicFifoBuffer.hxx.


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