29#ifndef MYSQL_BINLOG_EVENT_COMPRESSION_BUFFER_BUFFER_SEQUENCE_VIEW_H
30#define MYSQL_BINLOG_EVENT_COMPRESSION_BUFFER_BUFFER_SEQUENCE_VIEW_H
68template <
class Char_tp =
unsigned char,
69 template <
class Element_tp,
class Allocator_tp>
class Container_tp =
71 bool const_tp =
false>
79 using Container_t = Container_tp<Buffer_view_t, Buffer_allocator_t>;
83 typename Container_t::iterator>
::type;
88 std::numeric_limits<Size_t>::max();
140 template <
class Destination_
char_t>
141 void copy(Destination_char_t *destination)
const {
144 for (
const auto &
buffer : *
this) {
152 template <
class Str_char_t = char,
153 class Str_traits_t = std::char_traits<Str_char_t>,
154 class Str_allocator_t = std::allocator<Str_char_t>>
155 std::basic_string<Str_char_t, Str_traits_t, Str_allocator_t>
str(
156 const Str_allocator_t &allocator = Str_allocator_t()) {
157 std::basic_string<Str_char_t, Str_traits_t, Str_allocator_t> ret(
158 this->
size(),
'\0', allocator);
186 [[maybe_unused]]
int indent = 0)
const {
194 ws = std::string(
"\n") +
195 std::string(
static_cast<std::string::size_type
>(indent * 2),
' ');
199 std::string sep =
"," + ws;
201 std::string ws2 = (indent != 0) ? (ws +
" ") : ws;
202 std::string sep2 = (indent != 0) ? (sep +
" ") : sep;
204 ss <<
"Buffer_sequence_view(ptr=" << (
const void *)
this
205 << sep <<
"size=" <<
size()
206 << sep <<
"buffers.ptr=" << (
const void *)&*this->
begin()
207 << sep <<
"buffers=[";
210 for (
auto &
buffer : *
this) {
212 if (indent != 0) ss << ws2;
217 ss <<
buffer.debug_string(show_contents);
Class that groups a pointer+size as one object, without managing the memory for it.
Sequence of memory buffers.
Definition: buffer_sequence_view.h:72
Container_tp< Buffer_view_t, Buffer_allocator_t > Container_t
Definition: buffer_sequence_view.h:79
Const_iterator_t cend() const
Const iterator pointing to the last buffer.
Definition: buffer_sequence_view.h:132
Iterator_t begin()
Iterator to the first buffer.
Definition: buffer_sequence_view.h:117
Size_t size() const
Return the total size of all buffers.
Definition: buffer_sequence_view.h:164
Buffer_sequence_view & operator=(Buffer_sequence_view &)=delete
typename std::conditional< const_tp, Const_iterator_t, typename Container_t::iterator >::type Iterator_t
Definition: buffer_sequence_view.h:83
std::string debug_string(bool show_contents=false, int indent=0) const
In debug mode, return a string that describes the internal structure of this object,...
Definition: buffer_sequence_view.h:185
Iterator_t end()
Iterator to the last buffer.
Definition: buffer_sequence_view.h:120
std::size_t Size_t
Definition: buffer_sequence_view.h:75
Iterator_t m_begin
Iterator to beginning of buffer.
Definition: buffer_sequence_view.h:226
Const_iterator_t end() const
Iterator to the last buffer.
Definition: buffer_sequence_view.h:126
Buffer_sequence_view(Buffer_sequence_view &&other) noexcept=default
Const_iterator_t cbegin() const
Const iterator pointing to the first buffer.
Definition: buffer_sequence_view.h:129
Buffer_sequence_view & operator=(Buffer_sequence_view &&) noexcept=default
Char_tp Char_t
Definition: buffer_sequence_view.h:74
Iterator_t m_end
Iterator to end of buffer.
Definition: buffer_sequence_view.h:229
Buffer_sequence_view(Buffer_sequence_view &)=delete
std::basic_string< Str_char_t, Str_traits_t, Str_allocator_t > str(const Str_allocator_t &allocator=Str_allocator_t())
Return a copy of all the data in this object, as a std::string object.
Definition: buffer_sequence_view.h:155
Const_iterator_t begin() const
Iterator to the first buffer.
Definition: buffer_sequence_view.h:123
typename Container_t::const_iterator Const_iterator_t
Definition: buffer_sequence_view.h:80
void copy(Destination_char_t *destination) const
Copy all data to the given, contiguous output buffer.
Definition: buffer_sequence_view.h:141
static constexpr Size_t uninitialized_size
Indicates that m_size has not yet been computed.
Definition: buffer_sequence_view.h:87
Buffer_sequence_view(Iterator_t begin_arg, Iterator_t end_arg, Size_t size_arg=uninitialized_size)
Construct a Buffer_sequence_view with buffers in the range given by the iterators.
Definition: buffer_sequence_view.h:104
Size_t m_size
Total size of all buffers, cached.
Definition: buffer_sequence_view.h:232
Allocator using a Memory_resource to do the allocator.
Definition: allocator.h:54
void * data() const noexcept
Definition: buffer.h:119
size_t size() const noexcept
Definition: buffer.h:120
Allocator class that uses a polymorphic Memory_resource to allocate memory.
Definition: buffer_sequence_view.h:51
type
Definition: base.h:40
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2870
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2874
static task_arg end_arg()
Definition: task.h:207
Contains wrapper functions for memory allocation and deallocation.
#define BAPI_TRACE
Definition: wrapper_functions.h:65