ゴミ箱
Public Types | Public Member Functions | Friends | List of all members
boost::beast::basic_flat_buffer< Allocator > Class Template Reference

#include <flat_buffer.hpp>

Inheritance diagram for boost::beast::basic_flat_buffer< Allocator >:
boost::beast::detail::empty_base_optimization< detail::allocator_traits< Allocator >::template rebind_alloc< char > >

Public Types

using allocator_type = Allocator
 The type of allocator used. More...
 
using const_buffers_type = boost::asio::mutable_buffers_1
 The type used to represent the input sequence as a list of buffers. More...
 
using mutable_buffers_type = boost::asio::mutable_buffers_1
 The type used to represent the output sequence as a list of buffers. More...
 

Public Member Functions

 ~basic_flat_buffer ()
 Destructor. More...
 
 basic_flat_buffer ()
 
 basic_flat_buffer (std::size_t limit)
 
 basic_flat_buffer (Allocator const &alloc)
 
 basic_flat_buffer (std::size_t limit, Allocator const &alloc)
 
 basic_flat_buffer (basic_flat_buffer &&other)
 
 basic_flat_buffer (basic_flat_buffer &&other, Allocator const &alloc)
 
 basic_flat_buffer (basic_flat_buffer const &other)
 
 basic_flat_buffer (basic_flat_buffer const &other, Allocator const &alloc)
 
template<class OtherAlloc >
 basic_flat_buffer (basic_flat_buffer< OtherAlloc > const &other)
 
template<class OtherAlloc >
 basic_flat_buffer (basic_flat_buffer< OtherAlloc > const &other, Allocator const &alloc)
 
basic_flat_bufferoperator= (basic_flat_buffer &&other)
 
basic_flat_bufferoperator= (basic_flat_buffer const &other)
 
template<class OtherAlloc >
basic_flat_bufferoperator= (basic_flat_buffer< OtherAlloc > const &other)
 
allocator_type get_allocator () const
 Returns a copy of the associated allocator. More...
 
std::size_t size () const
 Returns 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
 Get a list of buffers that represent the input sequence. More...
 
mutable_buffers_type prepare (std::size_t n)
 
void commit (std::size_t n)
 
void consume (std::size_t n)
 
void shrink_to_fit ()
 
template<class OtherAlloc >
auto operator= (basic_flat_buffer< OtherAlloc > const &other) -> basic_flat_buffer &
 

Friends

template<class OtherAlloc >
class basic_flat_buffer
 
template<class Alloc >
void swap (basic_flat_buffer< Alloc > &lhs, basic_flat_buffer< Alloc > &rhs)
 Exchange two flat buffers. More...
 

Detailed Description

template<class Allocator>
class boost::beast::basic_flat_buffer< Allocator >

A linear dynamic buffer.

Objects of this type meet the requirements of DynamicBuffer and offer additional invariants:

Upon construction, a maximum size for the buffer may be specified. If this limit is exceeded, the std::length_error exception will be thrown.

Note
This class is designed for use with algorithms that take dynamic buffers as parameters, and are optimized for the case where the input sequence or output sequence is stored in a single contiguous buffer.

Member Typedef Documentation

template<class Allocator>
using boost::beast::basic_flat_buffer< Allocator >::allocator_type = Allocator

The type of allocator used.

template<class Allocator>
using boost::beast::basic_flat_buffer< Allocator >::const_buffers_type = boost::asio::mutable_buffers_1

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

template<class Allocator>
using boost::beast::basic_flat_buffer< Allocator >::mutable_buffers_type = boost::asio::mutable_buffers_1

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

Constructor & Destructor Documentation

template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::~basic_flat_buffer ( )

Destructor.

template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( )

Constructor

Upon construction, capacity will be zero.

template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( std::size_t  limit)
explicit

Constructor

Upon construction, capacity will be zero.

Parameters
limitThe setting for max_size.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( Allocator const &  alloc)
explicit

Constructor

Upon construction, capacity will be zero.

Parameters
allocThe allocator to construct with.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( std::size_t  limit,
Allocator const &  alloc 
)

Constructor

Upon construction, capacity will be zero.

Parameters
limitThe setting for max_size.
allocThe allocator to use.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< Allocator > &&  other)

Constructor

After the move, *this will have an empty output sequence.

Parameters
otherThe object to move from. After the move, The object's state will be as if constructed using its current allocator and limit.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< Allocator > &&  other,
Allocator const &  alloc 
)

Constructor

After the move, *this will have an empty output sequence.

Parameters
otherThe object to move from. After the move, The object's state will be as if constructed using its current allocator and limit.
allocThe allocator to use.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< Allocator > const &  other)

Constructor

Parameters
otherThe object to copy from.
template<class Allocator >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< Allocator > const &  other,
Allocator const &  alloc 
)

Constructor

Parameters
otherThe object to copy from.
allocThe allocator to use.
template<class Allocator >
template<class OtherAlloc >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< OtherAlloc > const &  other)

Constructor

Parameters
otherThe object to copy from.
template<class Allocator >
template<class OtherAlloc >
boost::beast::basic_flat_buffer< Allocator >::basic_flat_buffer ( basic_flat_buffer< OtherAlloc > const &  other,
Allocator const &  alloc 
)

Constructor

Parameters
otherThe object to copy from.
allocThe allocator to use.

Member Function Documentation

template<class Allocator>
std::size_t boost::beast::basic_flat_buffer< Allocator >::capacity ( ) const
inline

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

template<class Allocator>
void boost::beast::basic_flat_buffer< Allocator >::commit ( std::size_t  n)
inline

Move bytes from the output sequence to the input sequence.

Parameters
nThe number of bytes to move. If this is larger than the number of bytes in the output sequences, then the entire output sequences is moved.
Note
All previous buffers sequences obtained from calls to data or prepare are invalidated.
template<class Allocator >
void boost::beast::basic_flat_buffer< Allocator >::consume ( std::size_t  n)

Remove bytes from the input sequence.

If n is greater than the number of bytes in the input sequence, all bytes in the input sequence are removed.

Note
All previous buffers sequences obtained from calls to data or prepare are invalidated.
template<class Allocator>
const_buffers_type boost::beast::basic_flat_buffer< Allocator >::data ( ) const
inline

Get a list of buffers that represent the input sequence.

template<class Allocator>
allocator_type boost::beast::basic_flat_buffer< Allocator >::get_allocator ( ) const
inline

Returns a copy of the associated allocator.

template<class Allocator>
std::size_t boost::beast::basic_flat_buffer< Allocator >::max_size ( ) const
inline

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

template<class Allocator >
auto boost::beast::basic_flat_buffer< Allocator >::operator= ( basic_flat_buffer< Allocator > &&  other)

Assignment

After the move, *this will have an empty output sequence.

Parameters
otherThe object to move from. After the move, the object's state will be as if constructed using its current allocator and limit.
template<class Allocator >
auto boost::beast::basic_flat_buffer< Allocator >::operator= ( basic_flat_buffer< Allocator > const &  other)

Assignment

After the copy, *this will have an empty output sequence.

Parameters
otherThe object to copy from.
template<class Allocator>
template<class OtherAlloc >
basic_flat_buffer& boost::beast::basic_flat_buffer< Allocator >::operator= ( basic_flat_buffer< OtherAlloc > const &  other)

Copy assignment

After the copy, *this will have an empty output sequence.

Parameters
otherThe object to copy from.
template<class Allocator>
template<class OtherAlloc >
auto boost::beast::basic_flat_buffer< Allocator >::operator= ( basic_flat_buffer< OtherAlloc > const &  other) -> basic_flat_buffer&
template<class Allocator >
auto boost::beast::basic_flat_buffer< Allocator >::prepare ( std::size_t  n)

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

Exceptions
std::length_errorif size() + n exceeds max_size().
Note
All previous buffers sequences obtained from calls to data or prepare are invalidated.
template<class Allocator >
void boost::beast::basic_flat_buffer< Allocator >::shrink_to_fit ( )

Reallocate the buffer to fit the input sequence.

Note
All previous buffers sequences obtained from calls to data or prepare are invalidated.
template<class Allocator>
std::size_t boost::beast::basic_flat_buffer< Allocator >::size ( ) const
inline

Returns the size of the input sequence.

Friends And Related Function Documentation

template<class Allocator>
template<class OtherAlloc >
friend class basic_flat_buffer
friend
template<class Allocator>
template<class Alloc >
void swap ( basic_flat_buffer< Alloc > &  lhs,
basic_flat_buffer< Alloc > &  rhs 
)
friend

Exchange two flat buffers.


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