MySQL 8.0.39
Source Code Documentation
mysqlns::buffer::Preallocated_managed_buffer< Char_t, preallocated_size > Class Template Reference

#include <managed_buffer.h>

Inheritance diagram for mysqlns::buffer::Preallocated_managed_buffer< Char_t, preallocated_size >:
[legend]

Public Member Functions

 Preallocated_managed_buffer (const Memory_resource_t &memory_resource=Memory_resource_t())
 
- Public Member Functions inherited from mysqlns::buffer::Managed_buffer< unsigned char >
 Managed_buffer (const Memory_resource_t &memory_resource=Memory_resource_t())
 Construct a new object without a default buffer. More...
 
 Managed_buffer (Size_t default_capacity, const Memory_resource_t &memory_resource=Memory_resource_t())
 Construct a new object that owns a default buffer. More...
 
 Managed_buffer (Buffer_view_t default_buffer, const Memory_resource_t &memory_resource=Memory_resource_t())
 Construct a new object that uses the given default buffer. More...
 
 Managed_buffer (Managed_buffer &other)=delete
 
 Managed_buffer (Managed_buffer &&other) noexcept=default
 
Managed_bufferoperator= (Managed_buffer &other)=delete
 
Managed_bufferoperator= (Managed_buffer &&other) noexcept=default
 
 ~Managed_buffer () override
 
Grow_status reserve_total_size (Size_t requested_size)
 Reserve space so that the total buffer size is at least the given number. More...
 
Grow_status reserve_write_size (Size_t requested_write_size)
 Reserve space so that the write size is at least the given number. More...
 
void reset ()
 Reset the buffer. More...
 
void set_grow_calculator (const Grow_calculator_t &grow_calculator)
 Set the grow calculator. More...
 
const Grow_calculator_tget_grow_calculator () const
 Return a const reference to the grow calculator. More...
 
Size_t get_default_capacity ()
 Return the size of the default buffer. More...
 
- Public Member Functions inherited from mysqlns::buffer::Rw_buffer< unsigned char >
 Rw_buffer ()=default
 
 Rw_buffer (Buffer_view_t buffer)
 Create a new Rw_buffer from the specified size and buffer. More...
 
 Rw_buffer (Rw_buffer &)=delete
 Deleted copy constructor. More...
 
 Rw_buffer (Rw_buffer &&) noexcept=default
 Default move constructor. More...
 
Rw_bufferoperator= (Rw_buffer &)=delete
 Deleted copy assignment operator. More...
 
Rw_bufferoperator= (Rw_buffer &&) noexcept=default
 Default move assignment operator. More...
 
virtual ~Rw_buffer ()=default
 Default delete operator. More...
 
const Buffer_view_tread_part () const
 Return the read part. More...
 
Buffer_view_tread_part ()
 Return the read part. More...
 
const Buffer_view_twrite_part () const
 Return the write part. More...
 
Buffer_view_twrite_part ()
 Return the write part. More...
 
Size_t capacity () const
 Return the total size of the read part and the write part. More...
 
void set_position (Size_t new_position)
 Set the position to a fixed number. More...
 
void increase_position (Size_t increment)
 Increase the position right, relative to the currrent position. More...
 
void move_position (Difference_t delta)
 Move the position left or right, relative to the current position. More...
 

Private Attributes

Char_t m_preallocated_buffer [preallocated_size==0 ? 1 :preallocated_size]
 Preallocated buffer. More...
 

Additional Inherited Members

- Public Types inherited from mysqlns::buffer::Managed_buffer< unsigned char >
using Char_t = unsigned char
 
using Buffer_view_t = Buffer_view< Char_t >
 
using Rw_buffer_t = Rw_buffer< Char_t >
 
using Memory_resource_t = mysqlns::resource::Memory_resource
 
using Char_allocator_t = mysqlns::resource::Allocator< Char_t >
 
using Grow_calculator_t = Grow_calculator
 
using Const_iterator_t = const Char_t *
 
using Iterator_t = Char_t *
 
using Size_t = std::size_t
 
- Public Types inherited from mysqlns::buffer::Rw_buffer< unsigned char >
using Char_t = unsigned char
 
using Size_t = std::size_t
 
using Difference_t = std::ptrdiff_t
 
using Iterator_t = Char_t *
 
using Const_iterator_t = const Char_t *
 
using Buffer_view_t = mysqlns::buffer::Buffer_view< Char_t >
 
- Protected Attributes inherited from mysqlns::buffer::Rw_buffer< unsigned char >
Buffer_view_t m_read_part
 
Buffer_view_t m_write_part
 

Detailed Description

template<class Char_t = unsigned char, std::size_t preallocated_size = default_preallocated_managed_buffer_size>
class mysqlns::buffer::Preallocated_managed_buffer< Char_t, preallocated_size >
See also
Managed_buffer

This class pre-allocates a fixed-size initial buffer, which is beneficial in use patterns where managed buffers are allocated on the stack and are usually only given small amount of data.

Constructor & Destructor Documentation

◆ Preallocated_managed_buffer()

template<class Char_t = unsigned char, std::size_t preallocated_size = default_preallocated_managed_buffer_size>
mysqlns::buffer::Preallocated_managed_buffer< Char_t, preallocated_size >::Preallocated_managed_buffer ( const Memory_resource_t memory_resource = Memory_resource_t())
inlineexplicit

Member Data Documentation

◆ m_preallocated_buffer

template<class Char_t = unsigned char, std::size_t preallocated_size = default_preallocated_managed_buffer_size>
Char_t mysqlns::buffer::Preallocated_managed_buffer< Char_t, preallocated_size >::m_preallocated_buffer[preallocated_size==0 ? 1 :preallocated_size]
private

Preallocated buffer.


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