ゴミ箱
|
#include <static_buffer.hpp>
Public Types | |
using | const_buffers_type = std::array< boost::asio::mutable_buffer, 2 > |
The type used to represent the input sequence as a list of buffers. More... | |
using | mutable_buffers_type = std::array< boost::asio::mutable_buffer, 2 > |
The type used to represent the output sequence as a list of buffers. More... | |
Public Member Functions | |
static_buffer_base (void *p, std::size_t size) | |
std::size_t | size () const |
Return the size of the input sequence. More... | |
std::size_t | max_size () const |
Return the maximum sum of the input and output sequence sizes. More... | |
std::size_t | capacity () const |
Return the maximum sum of input and output sizes that can be held without an allocation. More... | |
const_buffers_type | data () const |
mutable_buffers_type | prepare (std::size_t size) |
void | commit (std::size_t size) |
void | consume (std::size_t size) |
Protected Member Functions | |
static_buffer_base () | |
void | reset (void *p, std::size_t size) |
A circular DynamicBuffer with a fixed size internal buffer.
This implements a circular dynamic buffer. Calls to prepare never require moving memory. The buffer sequences returned may be up to length two. Ownership of the underlying storage belongs to the derived class.
When used with static_buffer this implements a dynamic buffer using no memory allocations.
using boost::beast::static_buffer_base::const_buffers_type = std::array<boost::asio::mutable_buffer, 2> |
The type used to represent the input sequence as a list of buffers.
using boost::beast::static_buffer_base::mutable_buffers_type = std::array<boost::asio::mutable_buffer, 2> |
The type used to represent the output sequence as a list of buffers.
|
inline |
Constructor
This creates a dynamic buffer using the provided storage area.
p | A pointer to valid storage of at least n bytes. |
size | The number of valid bytes pointed to by p . |
|
protected |
Constructor
The buffer will be in an undefined state. It is necessary for the derived class to call reset in order to initialize the object.
|
inline |
Return the maximum sum of input and output sizes that can be held without an allocation.
|
inline |
Move bytes from the output sequence to the input sequence.
size | The nubmer of bytes to commit. If this is greater than the size of the output sequence, the entire output sequence is committed. |
|
inline |
Remove bytes from the input sequence.
size | The number of bytes to consume. If this is greater than the size of the input sequence, the entire input sequence is consumed. |
|
inline |
Get a list of buffers that represent the input sequence.
|
inline |
Return the maximum sum of the input and output sequence sizes.
|
inline |
Get a list of buffers that represent the output sequence, with the given size.
size | The number of bytes to request. |
std::length_error | if the size would exceed the capacity. |
|
inlineprotected |
Reset the pointed-to buffer.
This function resets the internal state to the buffer provided. All input and output sequences are invalidated. This function allows the derived class to construct its members before initializing the static buffer.
p | A pointer to valid storage of at least n bytes. |
size | The number of valid bytes pointed to by p . |
|
inline |
Return the size of the input sequence.