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

#include <flat_static_buffer.hpp>

Inheritance diagram for boost::beast::flat_static_buffer_base:
boost::beast::flat_static_buffer< N > boost::beast::flat_static_buffer< 14 > boost::beast::flat_static_buffer< 2+8+4+125 > boost::beast::flat_static_buffer< 4096 >

Public Types

using const_buffers_type = boost::asio::mutable_buffers_1
 
using mutable_buffers_type = boost::asio::mutable_buffers_1
 

Public Member Functions

 flat_static_buffer_base (void *p, std::size_t n)
 
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
 
void reset ()
 Set the input and output sequences to size 0. More...
 
mutable_buffers_type prepare (std::size_t n)
 
void commit (std::size_t n)
 
void consume (std::size_t n)
 Remove bytes from the input sequence. More...
 
template<class >
auto prepare_impl (std::size_t n) -> mutable_buffers_type
 

Protected Member Functions

 flat_static_buffer_base ()=default
 
void reset (void *p, std::size_t n)
 

Detailed Description

A flat DynamicBuffer with a fixed size internal buffer.

Buffer sequences returned by data and prepare will always be of length one. Ownership of the underlying storage belongs to the derived class.

Note
Variables are usually declared using the template class flat_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 flat_static_buffer_base.

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

See also
flat_static_buffer

Member Typedef Documentation

using boost::beast::flat_static_buffer_base::const_buffers_type = boost::asio::mutable_buffers_1

The type used to represent the input sequence as a list of buffers.

This buffer sequence is guaranteed to have length 1.

using boost::beast::flat_static_buffer_base::mutable_buffers_type = boost::asio::mutable_buffers_1

The type used to represent the output sequence as a list of buffers.

This buffer sequence is guaranteed to have length 1.

Constructor & Destructor Documentation

boost::beast::flat_static_buffer_base::flat_static_buffer_base ( void *  p,
std::size_t  n 
)
inline

Constructor

This creates a dynamic buffer using the provided storage area.

Parameters
pA pointer to valid storage of at least n bytes.
nThe number of valid bytes pointed to by p.
boost::beast::flat_static_buffer_base::flat_static_buffer_base ( )
protecteddefault

Constructor

The buffer will be in an undefined state. It is necessary for the derived class to call reset with a pointer and size in order to initialize the object.

Member Function Documentation

std::size_t boost::beast::flat_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::flat_static_buffer_base::commit ( std::size_t  n)
inline

Move bytes from the output sequence to the input sequence.

Note
Buffers representing the input sequence acquired prior to this call remain valid.
void boost::beast::flat_static_buffer_base::consume ( std::size_t  n)
inline

Remove bytes from the input sequence.

auto boost::beast::flat_static_buffer_base::data ( ) const
inline

Get a list of buffers that represent the input sequence.

Note
These buffers remain valid across subsequent calls to prepare.
std::size_t boost::beast::flat_static_buffer_base::max_size ( ) const
inline

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

auto boost::beast::flat_static_buffer_base::prepare ( std::size_t  n)
inline

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

Exceptions
std::length_errorif the size would exceed the limit imposed by the underlying mutable buffer sequence.
Note
Buffers representing the input sequence acquired prior to this call remain valid.
template<class >
auto boost::beast::flat_static_buffer_base::prepare_impl ( std::size_t  n) -> mutable_buffers_type
void boost::beast::flat_static_buffer_base::reset ( )
inline

Set the input and output sequences to size 0.

void boost::beast::flat_static_buffer_base::reset ( void *  p,
std::size_t  n 
)
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.
nThe number of valid bytes pointed to by p.
std::size_t boost::beast::flat_static_buffer_base::size ( ) const
inline

Return the size of the input sequence.


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