MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
ForeignFifoBuffer< 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 <ForeignFifoBuffer.hxx>`

Inheritance diagram for ForeignFifoBuffer< T >:
[legend]

## Public Types
typedef size_t | size_type
typedef WritableBuffer< T > | Range
typedef Range::pointer_type | pointer_type
typedef Range::const_pointer_type | const_pointer_type

## Public Member Functions
constexpr | ForeignFifoBuffer (std::nullptr_t n)
constexpr | ForeignFifoBuffer (T *_data, size_type _capacity)
| ForeignFifoBuffer (ForeignFifoBuffer &&src)
ForeignFifoBuffer & | operator= (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 Member Functions
void | Shift ()

## Protected Attributes
size_type | head
size_type | tail
size_type | capacity
T * | data

## Detailed Description

### template<typename T>
class ForeignFifoBuffer< 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.

This class does not manage buffer memory. It will not allocate or free any memory, it only manages the contents of an existing buffer given to the constructor.

Definition at line 52 of file ForeignFifoBuffer.hxx.

## Member Typedef Documentation

template<typename T>

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

Definition at line 57 of file ForeignFifoBuffer.hxx.

template<typename T>

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

Definition at line 56 of file ForeignFifoBuffer.hxx.

template<typename T>

typedef WritableBuffer<T> ForeignFifoBuffer< T >::Range

Definition at line 55 of file ForeignFifoBuffer.hxx.

template<typename T>

typedef size_t ForeignFifoBuffer< T >::size_type

Definition at line 54 of file ForeignFifoBuffer.hxx.

## Constructor & Destructor Documentation

template<typename T>

constexpr ForeignFifoBuffer< T >::ForeignFifoBuffer | ( | std::nullptr_t | n | ) |
| inline explicit

Definition at line 64 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr ForeignFifoBuffer< T >::ForeignFifoBuffer | ( | T * | _data,
|  | size_type | _capacity
| ) |  |
| inline

Definition at line 67 of file ForeignFifoBuffer.hxx.

template<typename T>

ForeignFifoBuffer< T >::ForeignFifoBuffer | ( | ForeignFifoBuffer< T > && | src | ) |
| inline

Definition at line 70 of file ForeignFifoBuffer.hxx.

## Member Function Documentation

template<typename T>

void ForeignFifoBuffer< T >::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 177 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::Clear | ( |  | ) |
| inline

Definition at line 133 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::Consume | ( | size_type | n | ) |
| inline

Marks a chunk as consumed.

Definition at line 200 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr size_type ForeignFifoBuffer< T >::GetAvailable | ( |  | ) | const
| inline

Definition at line 185 of file ForeignFifoBuffer.hxx.

template<typename T>

T* ForeignFifoBuffer< T >::GetBuffer | ( |  | ) |
| inline

Definition at line 100 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr size_type ForeignFifoBuffer< T >::GetCapacity | ( |  | ) | const
| inline

Definition at line 104 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr bool ForeignFifoBuffer< T >::IsDefined | ( |  | ) | const
| inline

Definition at line 96 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr bool ForeignFifoBuffer< T >::IsEmpty | ( |  | ) | const
| inline

Definition at line 137 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr bool ForeignFifoBuffer< T >::IsFull | ( |  | ) | const
| inline

Definition at line 141 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr bool ForeignFifoBuffer< T >::IsNull | ( |  | ) | const
| inline

Definition at line 92 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::MoveBuffer | ( | T * | new_data,
|  | size_type | new_capacity
| ) |  |
| inline

Definition at line 123 of file ForeignFifoBuffer.hxx.

template<typename T>

size_type ForeignFifoBuffer< T >::MoveFrom | ( | ForeignFifoBuffer< T > & | src | ) |
| inline

Move as much data as possible from the specified buffer.

Returns
  the number of items moved

Definition at line 223 of file ForeignFifoBuffer.hxx.

template<typename T>

ForeignFifoBuffer& ForeignFifoBuffer< T >::operator= | ( | ForeignFifoBuffer< T > && | src | ) |
| inline

Definition at line 76 of file ForeignFifoBuffer.hxx.

template<typename T>

constexpr Range ForeignFifoBuffer< T >::Read | ( |  | ) | const
| inline

Return a buffer range which may be read.

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

Definition at line 193 of file ForeignFifoBuffer.hxx.

template<typename T>

size_type ForeignFifoBuffer< T >::Read | ( | pointer_type | p,
|  | size_type | n
| ) |  |
| inline

Definition at line 209 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::SetBuffer | ( | T * | _data,
|  | size_type | _capacity
| ) |  |
| inline

Definition at line 114 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::SetNull | ( |  | ) |
| inline

Definition at line 108 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::Shift | ( |  | ) |
| inline protected

Definition at line 235 of file ForeignFifoBuffer.hxx.

template<typename T>

void ForeignFifoBuffer< T >::Swap | ( | ForeignFifoBuffer< T > & | other | ) |
| inline

Definition at line 85 of file ForeignFifoBuffer.hxx.

template<typename T>

bool ForeignFifoBuffer< T >::WantWrite | ( | size_type | n | ) |
| inline

Definition at line 158 of file ForeignFifoBuffer.hxx.

template<typename T>

Range ForeignFifoBuffer< T >::Write | ( |  | ) |
| inline

Prepares writing.

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

Definition at line 149 of file ForeignFifoBuffer.hxx.

## Field Documentation

template<typename T>

size_type ForeignFifoBuffer< T >::capacity
| protected

Definition at line 60 of file ForeignFifoBuffer.hxx.

template<typename T>

T* ForeignFifoBuffer< T >::data
| protected

Definition at line 61 of file ForeignFifoBuffer.hxx.

template<typename T>

size_type ForeignFifoBuffer< T >::head
| protected

Definition at line 60 of file ForeignFifoBuffer.hxx.

template<typename T>

size_type ForeignFifoBuffer< T >::tail
| protected

Definition at line 60 of file ForeignFifoBuffer.hxx.

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

- util/ForeignFifoBuffer.hxx