MySQL 9.1.0
Source Code Documentation
classic_protocol::impl::EncodeBufferAccumulator Class Reference

accumulator of encoded buffers. More...

#include <classic_protocol_codec_base.h>

Public Types

using result_type = stdx::expected< size_t, std::error_code >
 

Public Member Functions

 EncodeBufferAccumulator (net::mutable_buffer buffer, capabilities::value_type caps, size_t consumed=0)
 construct a encode-buffer-accumulator. More...
 
template<class T >
EncodeBufferAccumulatorstep (const T &v)
 encode a T into the buffer and move position forward. More...
 
result_type result () const
 get result the steps(). More...
 

Private Attributes

const net::mutable_buffer buffer_
 
const capabilities::value_type caps_
 
size_t consumed_ {}
 
result_type res_
 

Detailed Description

accumulator of encoded buffers.

writes the .step()ed encoded types into buffer.

EncodeBufferAccumulator(buffer, caps) .step(wire::VarInt(42)) .step(wire::VarInt(512)) .result()

The class should be used together with EncodeSizeAccumulator which shares the same interface.

Member Typedef Documentation

◆ result_type

Constructor & Destructor Documentation

◆ EncodeBufferAccumulator()

classic_protocol::impl::EncodeBufferAccumulator::EncodeBufferAccumulator ( net::mutable_buffer  buffer,
capabilities::value_type  caps,
size_t  consumed = 0 
)
inline

construct a encode-buffer-accumulator.

Parameters
buffermutable-buffer to encode into
capsprotocol capabilities
consumedbytes already used in the in buffer

Member Function Documentation

◆ result()

result_type classic_protocol::impl::EncodeBufferAccumulator::result ( ) const
inline

get result the steps().

Returns
last used position in buffer, or first error in case of a step() failed.

◆ step()

template<class T >
EncodeBufferAccumulator & classic_protocol::impl::EncodeBufferAccumulator::step ( const T &  v)
inline

encode a T into the buffer and move position forward.

no-op of a previous step failed.

Member Data Documentation

◆ buffer_

const net::mutable_buffer classic_protocol::impl::EncodeBufferAccumulator::buffer_
private

◆ caps_

const capabilities::value_type classic_protocol::impl::EncodeBufferAccumulator::caps_
private

◆ consumed_

size_t classic_protocol::impl::EncodeBufferAccumulator::consumed_ {}
private

◆ res_

result_type classic_protocol::impl::EncodeBufferAccumulator::res_
private

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