ゴミ箱
Public Types | Public Member Functions | Protected Member Functions | List of all members
boost::beast::static_buffer_base Class Reference

#include <static_buffer.hpp>

Inheritance diagram for boost::beast::static_buffer_base:
boost::beast::static_buffer< N > boost::beast::static_buffer< +tcp_frame_size >

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)
 

Detailed Description

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.

Note
Variables are usually declared using the template class static_buffer; however, to reduce the number of instantiations of template functions receiving static stream buffer arguments in a deduced context, the signature of the receiving function should use static_buffer_base.

When used with static_buffer this implements a dynamic buffer using no memory allocations.

See also
static_buffer

Member Typedef Documentation

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.

Constructor & Destructor Documentation

boost::beast::static_buffer_base::static_buffer_base ( void *  p,
std::size_t  size 
)
inline

Constructor

This creates a dynamic buffer using the provided storage area.

Parameters
pA pointer to valid storage of at least n bytes.
sizeThe number of valid bytes pointed to by p.
boost::beast::static_buffer_base::static_buffer_base ( )
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.

Member Function Documentation

std::size_t boost::beast::static_buffer_base::capacity ( ) const
inline

Return the maximum sum of input and output sizes that can be held without an allocation.

void boost::beast::static_buffer_base::commit ( std::size_t  size)
inline

Move bytes from the output sequence to the input sequence.

Parameters
sizeThe nubmer of bytes to commit. If this is greater than the size of the output sequence, the entire output sequence is committed.
void boost::beast::static_buffer_base::consume ( std::size_t  size)
inline

Remove bytes from the input sequence.

Parameters
sizeThe number of bytes to consume. If this is greater than the size of the input sequence, the entire input sequence is consumed.
auto boost::beast::static_buffer_base::data ( ) const
inline

Get a list of buffers that represent the input sequence.

std::size_t boost::beast::static_buffer_base::max_size ( ) const
inline

Return the maximum sum of the input and output sequence sizes.

auto boost::beast::static_buffer_base::prepare ( std::size_t  size)
inline

Get a list of buffers that represent the output sequence, with the given size.

Parameters
sizeThe number of bytes to request.
Exceptions
std::length_errorif the size would exceed the capacity.
void boost::beast::static_buffer_base::reset ( void *  p,
std::size_t  size 
)
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.

Parameters
pA pointer to valid storage of at least n bytes.
sizeThe number of valid bytes pointed to by p.
std::size_t boost::beast::static_buffer_base::size ( ) const
inline

Return the size of the input sequence.


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