Clementine
|
Adapt a vector to the DynamicBuffer requirements. More...
#include <buffer.hpp>
Public Types | |
typedef ASIO_CONST_BUFFER | const_buffers_type |
The type used to represent a sequence of constant buffers that refers to the underlying memory. More... | |
typedef ASIO_MUTABLE_BUFFER | mutable_buffers_type |
The type used to represent a sequence of mutable buffers that refers to the underlying memory. More... | |
Public Member Functions | |
dynamic_vector_buffer (std::vector< Elem, Allocator > &v, std::size_t maximum_size=(std::numeric_limits< std::size_t >::max)()) ASIO_NOEXCEPT | |
Construct a dynamic buffer from a vector. More... | |
dynamic_vector_buffer (const dynamic_vector_buffer &other) ASIO_NOEXCEPT | |
DynamicBuffer_v2: Copy construct a dynamic buffer. | |
std::size_t | size () const ASIO_NOEXCEPT |
DynamicBuffer_v1: Get the size of the input sequence. More... | |
std::size_t | max_size () const ASIO_NOEXCEPT |
Get the maximum size of the dynamic buffer. More... | |
std::size_t | capacity () const ASIO_NOEXCEPT |
Get the maximum size that the buffer may grow to without triggering reallocation. More... | |
const_buffers_type | data () const ASIO_NOEXCEPT |
DynamicBuffer_v1: Get a list of buffers that represents the input sequence. More... | |
mutable_buffers_type | data (std::size_t pos, std::size_t n) ASIO_NOEXCEPT |
DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. More... | |
const_buffers_type | data (std::size_t pos, std::size_t n) const ASIO_NOEXCEPT |
DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. More... | |
mutable_buffers_type | prepare (std::size_t n) |
DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. More... | |
void | commit (std::size_t n) |
DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. More... | |
void | grow (std::size_t n) |
DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. More... | |
void | shrink (std::size_t n) |
DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. More... | |
void | consume (std::size_t n) |
DynamicBuffer_v1: Remove characters from the input sequence. More... | |
Adapt a vector to the DynamicBuffer requirements.
Requires that sizeof(Elem) == 1
.
typedef ASIO_CONST_BUFFER asio::dynamic_vector_buffer< Elem, Allocator >::const_buffers_type |
The type used to represent a sequence of constant buffers that refers to the underlying memory.
typedef ASIO_MUTABLE_BUFFER asio::dynamic_vector_buffer< Elem, Allocator >::mutable_buffers_type |
The type used to represent a sequence of mutable buffers that refers to the underlying memory.
|
inlineexplicit |
Construct a dynamic buffer from a vector.
v | The vector to be used as backing storage for the dynamic buffer. The object stores a reference to the vector and the user is responsible for ensuring that the vector object remains valid while the dynamic_vector_buffer object, and copies of the object, are in use. |
maximum_size | Specifies a maximum size for the buffer, in bytes. |
|
inline |
Get the maximum size that the buffer may grow to without triggering reallocation.
|
inline |
DynamicBuffer_v1: Move bytes from the output sequence to the input sequence.
n | The number of bytes to append from the start of the output sequence to the end of the input sequence. The remainder of the output sequence is discarded. |
Requires a preceding call prepare(x)
where x >= n
, and no intervening operations that modify the input or output sequence.
n
is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued.
|
inline |
DynamicBuffer_v1: Remove characters from the input sequence.
DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. DynamicBuffer_v1: Removes n
characters from the beginning of the input sequence.
n
is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.DynamicBuffer_v2: Erases n
bytes from the beginning of the vector. If n
is greater than the current size of the vector, the vector is emptied.
|
inline |
DynamicBuffer_v1: Get a list of buffers that represents the input sequence.
const_buffers_type
that satisfies ConstBufferSequence requirements, representing the vector memory in the input sequence.dynamic_vector_buffer
or vector
member function that modifies the input sequence or output sequence.
|
inline |
DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory.
pos | Position of the first byte to represent in the buffer sequence |
n | The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available. |
mutable_buffers_type
that satisfies MutableBufferSequence requirements, representing the vector memory.dynamic_vector_buffer
or vector
member function that resizes or erases the vector.
|
inline |
DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory.
pos | Position of the first byte to represent in the buffer sequence |
n | The number of bytes to return in the buffer sequence. If the underlying memory is shorter, the buffer sequence represents as many bytes as are available. |
dynamic_vector_buffer
or vector
member function that resizes or erases the vector.
|
inline |
DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes.
Resizes the vector to accommodate an additional n
bytes at the end.
std::length_error | If size() + n > max_size() . |
|
inline |
Get the maximum size of the dynamic buffer.
|
inline |
DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size.
Ensures that the output sequence can accommodate n
bytes, resizing the vector object as necessary.
mutable_buffers_type
that satisfies MutableBufferSequence requirements, representing vector memory at the start of the output sequence of size n
.std::length_error | If size() + n > max_size() . |
dynamic_vector_buffer
or vector
member function that modifies the input sequence or output sequence.
|
inline |
DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes.
Erases n
bytes from the end of the vector by resizing the vector object. If n
is greater than the current size of the vector, the vector is emptied.
|
inline |
DynamicBuffer_v1: Get the size of the input sequence.
DynamicBuffer_v2: Get the current size of the underlying memory.