MySQL 8.4.2
Source Code Documentation
classic_protocol::impl::EncodeSizeAccumulator Class Reference

accumulates the sizes of encoded T's. More...

#include <classic_protocol_codec_base.h>

Public Types

using result_type = size_t
 

Public Member Functions

constexpr EncodeSizeAccumulator (capabilities::value_type caps)
 construct a EncodeSizeAccumulator. More...
 
template<class T >
constexpr EncodeSizeAccumulatorstep (const T &v) noexcept
 accumulate the size() of encoded T. More...
 
constexpr result_type result () const
 

Private Attributes

size_t consumed_ {}
 
const capabilities::value_type caps_
 

Detailed Description

accumulates the sizes of encoded T's.

e.g. the size of tw

EncodeSizeAccumulator(caps) .step(wire::VarInt(42)) // 1 .step(wire::VarInt(512)) // 2 .result() // = 3

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

Member Typedef Documentation

◆ result_type

Constructor & Destructor Documentation

◆ EncodeSizeAccumulator()

constexpr classic_protocol::impl::EncodeSizeAccumulator::EncodeSizeAccumulator ( capabilities::value_type  caps)
inlineexplicitconstexpr

construct a EncodeSizeAccumulator.

Member Function Documentation

◆ result()

constexpr result_type classic_protocol::impl::EncodeSizeAccumulator::result ( ) const
inlineconstexpr
Returns
size of all steps().

◆ step()

template<class T >
constexpr EncodeSizeAccumulator & classic_protocol::impl::EncodeSizeAccumulator::step ( const T &  v)
inlineconstexprnoexcept

accumulate the size() of encoded T.

calls Codec<T>(v, caps).size()

Member Data Documentation

◆ caps_

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

◆ consumed_

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

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