MPD: WritableBuffer< T > Struct Template Reference

MPD 0.20.18

Public Types | Public Member Functions | Static Public Member Functions | Data Fields
WritableBuffer< T > Struct Template Reference

A reference to a memory area that is writable. More...

`#include <Silence.hxx>`

## Public Types
typedef size_t | size_type
typedef T & | reference_type
typedef const T & | const_reference_type
typedef T * | pointer_type
typedef const T * | const_pointer_type
typedef pointer_type | iterator
typedef const_pointer_type | const_iterator

## Public Member Functions
| WritableBuffer ()=default
constexpr | WritableBuffer (std::nullptr_t)
constexpr | WritableBuffer (pointer_type _data, size_type _size)
constexpr WritableBuffer< void > | ToVoid () const
constexpr bool | IsNull () const
constexpr bool | IsEmpty () const
constexpr iterator | begin () const
constexpr iterator | end () const
constexpr const_iterator | cbegin () const
constexpr const_iterator | cend () const
reference_type | operator[] (size_type i) const
reference_type | front () const
| Returns a reference to the first element. More...
reference_type | back () const
| Returns a reference to the last element. More...
void | pop_front ()
| Remove the first element (by moving the head pointer, does not actually modify the buffer). More...
void | pop_back ()
| Remove the last element (by moving the tail pointer, does not actually modify the buffer). More...
reference_type | shift ()
| Remove the first element and return a reference to it. More...
void | skip_front (size_type n)

## Static Public Member Functions
static constexpr WritableBuffer | Null ()
static WritableBuffer< T > | FromVoid (WritableBuffer< void > other)
| Cast a WritableBuffer<void> to a WritableBuffer<T>. More...

## Data Fields
pointer_type | data
size_type | size

## Detailed Description

### template<typename T>
struct WritableBuffer< T >

A reference to a memory area that is writable.

See also
  ConstBuffer

Definition at line 27 of file Silence.hxx.

## Member Typedef Documentation

## ◆ const_iterator

template<typename T >

typedef const_pointer_type WritableBuffer< T >::const_iterator

Definition at line 88 of file WritableBuffer.hxx.

## ◆ const_pointer_type

template<typename T >

typedef const T* WritableBuffer< T >::const_pointer_type

Definition at line 86 of file WritableBuffer.hxx.

## ◆ const_reference_type

template<typename T >

typedef const T& WritableBuffer< T >::const_reference_type

Definition at line 84 of file WritableBuffer.hxx.

## ◆ iterator

template<typename T >

typedef pointer_type WritableBuffer< T >::iterator

Definition at line 87 of file WritableBuffer.hxx.

## ◆ pointer_type

template<typename T >

typedef T* WritableBuffer< T >::pointer_type

Definition at line 85 of file WritableBuffer.hxx.

## ◆ reference_type

template<typename T >

typedef T& WritableBuffer< T >::reference_type

Definition at line 83 of file WritableBuffer.hxx.

## ◆ size_type

template<typename T >

typedef size_t WritableBuffer< T >::size_type

Definition at line 82 of file WritableBuffer.hxx.

## Constructor & Destructor Documentation

## ◆ WritableBuffer() [1/3]

template<typename T >

WritableBuffer< T >::WritableBuffer | ( |  | ) |
| default

## ◆ WritableBuffer() [2/3]

template<typename T >

constexpr WritableBuffer< T >::WritableBuffer | ( | std::nullptr_t |  | ) |
| inline

Definition at line 95 of file WritableBuffer.hxx.

## ◆ WritableBuffer() [3/3]

template<typename T >

constexpr WritableBuffer< T >::WritableBuffer | ( | pointer_type | _data,
|  | size_type | _size
| ) |  |
| inline

Definition at line 97 of file WritableBuffer.hxx.

## Member Function Documentation

## ◆ back()

template<typename T >

reference_type WritableBuffer< T >::back | ( |  | ) | const
| inline

Returns a reference to the last element.

Buffer must not be empty.

Definition at line 183 of file WritableBuffer.hxx.

## ◆ begin()

template<typename T >

constexpr iterator WritableBuffer< T >::begin | ( |  | ) | const
| inline

Definition at line 135 of file WritableBuffer.hxx.

## ◆ cbegin()

template<typename T >

constexpr const_iterator WritableBuffer< T >::cbegin | ( |  | ) | const
| inline

Definition at line 143 of file WritableBuffer.hxx.

## ◆ cend()

template<typename T >

constexpr const_iterator WritableBuffer< T >::cend | ( |  | ) | const
| inline

Definition at line 147 of file WritableBuffer.hxx.

## ◆ end()

template<typename T >

constexpr iterator WritableBuffer< T >::end | ( |  | ) | const
| inline

Definition at line 139 of file WritableBuffer.hxx.

## ◆ FromVoid()

template<typename T >

static WritableBuffer<T> WritableBuffer< T >::FromVoid | ( | WritableBuffer< void > | other | ) |
| inlinestatic

Cast a WritableBuffer<void> to a WritableBuffer<T>.

A "void" buffer records its size in bytes, and when casting to "T", the assertion below ensures that the size is a multiple of sizeof(T).

Definition at line 113 of file WritableBuffer.hxx.

## ◆ front()

template<typename T >

reference_type WritableBuffer< T >::front | ( |  | ) | const
| inline

Returns a reference to the first element.

Buffer must not be empty.

Definition at line 169 of file WritableBuffer.hxx.

## ◆ IsEmpty()

template<typename T >

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

Definition at line 131 of file WritableBuffer.hxx.

## ◆ IsNull()

template<typename T >

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

Definition at line 127 of file WritableBuffer.hxx.

## ◆ Null()

template<typename T >

static constexpr WritableBuffer WritableBuffer< T >::Null | ( |  | ) |
| inlinestatic

Definition at line 100 of file WritableBuffer.hxx.

## ◆ operator[]()

template<typename T >

reference_type WritableBuffer< T >::operator[] | ( | size_type | i | ) | const
| inline

Definition at line 154 of file WritableBuffer.hxx.

## ◆ pop_back()

template<typename T >

void WritableBuffer< T >::pop_back | ( |  | ) |
| inline

Remove the last element (by moving the tail pointer, does not actually modify the buffer).

Buffer must not be empty.

Definition at line 205 of file WritableBuffer.hxx.

## ◆ pop_front()

template<typename T >

void WritableBuffer< T >::pop_front | ( |  | ) |
| inline

Remove the first element (by moving the head pointer, does not actually modify the buffer).

Buffer must not be empty.

Definition at line 194 of file WritableBuffer.hxx.

## ◆ shift()

template<typename T >

reference_type WritableBuffer< T >::shift | ( |  | ) |
| inline

Remove the first element and return a reference to it.

Buffer must not be empty.

Definition at line 215 of file WritableBuffer.hxx.

## ◆ skip_front()

template<typename T >

void WritableBuffer< T >::skip_front | ( | size_type | n | ) |
| inline

Definition at line 221 of file WritableBuffer.hxx.

## ◆ ToVoid()

template<typename T >

constexpr WritableBuffer<void> WritableBuffer< T >::ToVoid | ( |  | ) | const
| inline

Definition at line 122 of file WritableBuffer.hxx.

## Field Documentation

## ◆ data

template<typename T >

pointer_type WritableBuffer< T >::data

Definition at line 90 of file WritableBuffer.hxx.

## ◆ size

template<typename T >

size_type WritableBuffer< T >::size

Definition at line 91 of file WritableBuffer.hxx.

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

- pcm/Silence.hxx
- util/WritableBuffer.hxx