ESPHome 2026.3.0
Loading...
Searching...
No Matches
esphome::api::ProtoSize Class Reference

#include <proto.h>

Static Public Member Functions

static constexpr uint32_t ESPHOME_ALWAYS_INLINE varint (uint32_t value)
 Calculates the size in bytes needed to encode a uint32_t value as a varint.
 
static constexpr uint32_t varint (uint64_t value)
 Calculates the size in bytes needed to encode a uint64_t value as a varint.
 
static constexpr uint32_t varint (int32_t value)
 Calculates the size in bytes needed to encode an int32_t value as a varint.
 
static constexpr uint32_t varint (int64_t value)
 Calculates the size in bytes needed to encode an int64_t value as a varint.
 
static constexpr uint32_t field (uint32_t field_id, uint32_t type)
 Calculates the size in bytes needed to encode a field ID and wire type.
 
static constexpr uint32_t calc_int32 (uint32_t field_id_size, int32_t value)
 
static constexpr uint32_t calc_int32_force (uint32_t field_id_size, int32_t value)
 
static constexpr uint32_t calc_uint32 (uint32_t field_id_size, uint32_t value)
 
static constexpr uint32_t calc_uint32_force (uint32_t field_id_size, uint32_t value)
 
static constexpr uint32_t calc_bool (uint32_t field_id_size, bool value)
 
static constexpr uint32_t calc_bool_force (uint32_t field_id_size)
 
static constexpr uint32_t calc_float (uint32_t field_id_size, float value)
 
static constexpr uint32_t calc_fixed32 (uint32_t field_id_size, uint32_t value)
 
static constexpr uint32_t calc_sfixed32 (uint32_t field_id_size, int32_t value)
 
static constexpr uint32_t calc_sint32 (uint32_t field_id_size, int32_t value)
 
static constexpr uint32_t calc_sint32_force (uint32_t field_id_size, int32_t value)
 
static constexpr uint32_t calc_int64 (uint32_t field_id_size, int64_t value)
 
static constexpr uint32_t calc_int64_force (uint32_t field_id_size, int64_t value)
 
static constexpr uint32_t calc_uint64 (uint32_t field_id_size, uint64_t value)
 
static constexpr uint32_t calc_uint64_force (uint32_t field_id_size, uint64_t value)
 
static constexpr uint32_t calc_length (uint32_t field_id_size, size_t len)
 
static constexpr uint32_t calc_length_force (uint32_t field_id_size, size_t len)
 
static constexpr uint32_t calc_sint64 (uint32_t field_id_size, int64_t value)
 
static constexpr uint32_t calc_sint64_force (uint32_t field_id_size, int64_t value)
 
static constexpr uint32_t calc_fixed64 (uint32_t field_id_size, uint64_t value)
 
static constexpr uint32_t calc_sfixed64 (uint32_t field_id_size, int64_t value)
 
static constexpr uint32_t calc_message (uint32_t field_id_size, uint32_t nested_size)
 
static constexpr uint32_t calc_message_force (uint32_t field_id_size, uint32_t nested_size)
 

Detailed Description

Definition at line 478 of file proto.h.

Member Function Documentation

◆ calc_bool()

static constexpr uint32_t esphome::api::ProtoSize::calc_bool ( uint32_t field_id_size,
bool value )
inlinestaticconstexpr

Definition at line 595 of file proto.h.

◆ calc_bool_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_bool_force ( uint32_t field_id_size)
inlinestaticconstexpr

Definition at line 596 of file proto.h.

◆ calc_fixed32()

static constexpr uint32_t esphome::api::ProtoSize::calc_fixed32 ( uint32_t field_id_size,
uint32_t value )
inlinestaticconstexpr

Definition at line 600 of file proto.h.

◆ calc_fixed64()

static constexpr uint32_t esphome::api::ProtoSize::calc_fixed64 ( uint32_t field_id_size,
uint64_t value )
inlinestaticconstexpr

Definition at line 636 of file proto.h.

◆ calc_float()

static constexpr uint32_t esphome::api::ProtoSize::calc_float ( uint32_t field_id_size,
float value )
inlinestaticconstexpr

Definition at line 597 of file proto.h.

◆ calc_int32()

static constexpr uint32_t esphome::api::ProtoSize::calc_int32 ( uint32_t field_id_size,
int32_t value )
inlinestaticconstexpr

Definition at line 583 of file proto.h.

◆ calc_int32_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_int32_force ( uint32_t field_id_size,
int32_t value )
inlinestaticconstexpr

Definition at line 586 of file proto.h.

◆ calc_int64()

static constexpr uint32_t esphome::api::ProtoSize::calc_int64 ( uint32_t field_id_size,
int64_t value )
inlinestaticconstexpr

Definition at line 612 of file proto.h.

◆ calc_int64_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_int64_force ( uint32_t field_id_size,
int64_t value )
inlinestaticconstexpr

Definition at line 615 of file proto.h.

◆ calc_length()

static constexpr uint32_t esphome::api::ProtoSize::calc_length ( uint32_t field_id_size,
size_t len )
inlinestaticconstexpr

Definition at line 624 of file proto.h.

◆ calc_length_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_length_force ( uint32_t field_id_size,
size_t len )
inlinestaticconstexpr

Definition at line 627 of file proto.h.

◆ calc_message()

static constexpr uint32_t esphome::api::ProtoSize::calc_message ( uint32_t field_id_size,
uint32_t nested_size )
inlinestaticconstexpr

Definition at line 642 of file proto.h.

◆ calc_message_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_message_force ( uint32_t field_id_size,
uint32_t nested_size )
inlinestaticconstexpr

Definition at line 645 of file proto.h.

◆ calc_sfixed32()

static constexpr uint32_t esphome::api::ProtoSize::calc_sfixed32 ( uint32_t field_id_size,
int32_t value )
inlinestaticconstexpr

Definition at line 603 of file proto.h.

◆ calc_sfixed64()

static constexpr uint32_t esphome::api::ProtoSize::calc_sfixed64 ( uint32_t field_id_size,
int64_t value )
inlinestaticconstexpr

Definition at line 639 of file proto.h.

◆ calc_sint32()

static constexpr uint32_t esphome::api::ProtoSize::calc_sint32 ( uint32_t field_id_size,
int32_t value )
inlinestaticconstexpr

Definition at line 606 of file proto.h.

◆ calc_sint32_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_sint32_force ( uint32_t field_id_size,
int32_t value )
inlinestaticconstexpr

Definition at line 609 of file proto.h.

◆ calc_sint64()

static constexpr uint32_t esphome::api::ProtoSize::calc_sint64 ( uint32_t field_id_size,
int64_t value )
inlinestaticconstexpr

Definition at line 630 of file proto.h.

◆ calc_sint64_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_sint64_force ( uint32_t field_id_size,
int64_t value )
inlinestaticconstexpr

Definition at line 633 of file proto.h.

◆ calc_uint32()

static constexpr uint32_t esphome::api::ProtoSize::calc_uint32 ( uint32_t field_id_size,
uint32_t value )
inlinestaticconstexpr

Definition at line 589 of file proto.h.

◆ calc_uint32_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_uint32_force ( uint32_t field_id_size,
uint32_t value )
inlinestaticconstexpr

Definition at line 592 of file proto.h.

◆ calc_uint64()

static constexpr uint32_t esphome::api::ProtoSize::calc_uint64 ( uint32_t field_id_size,
uint64_t value )
inlinestaticconstexpr

Definition at line 618 of file proto.h.

◆ calc_uint64_force()

static constexpr uint32_t esphome::api::ProtoSize::calc_uint64_force ( uint32_t field_id_size,
uint64_t value )
inlinestaticconstexpr

Definition at line 621 of file proto.h.

◆ field()

static constexpr uint32_t esphome::api::ProtoSize::field ( uint32_t field_id,
uint32_t type )
inlinestaticconstexpr

Calculates the size in bytes needed to encode a field ID and wire type.

Parameters
field_idThe field identifier
typeThe wire type value (from the WireType enum in the protobuf spec)
Returns
The number of bytes needed to encode the field ID and wire type

Definition at line 576 of file proto.h.

◆ varint() [1/4]

static constexpr uint32_t esphome::api::ProtoSize::varint ( int32_t value)
inlinestaticconstexpr

Calculates the size in bytes needed to encode an int32_t value as a varint.

Special handling is needed for negative values, which are sign-extended to 64 bits in Protocol Buffers, resulting in a 10-byte varint.

Parameters
valueThe int32_t value to calculate size for
Returns
The number of bytes needed to encode the value

Definition at line 546 of file proto.h.

◆ varint() [2/4]

static constexpr uint32_t esphome::api::ProtoSize::varint ( int64_t value)
inlinestaticconstexpr

Calculates the size in bytes needed to encode an int64_t value as a varint.

Parameters
valueThe int64_t value to calculate size for
Returns
The number of bytes needed to encode the value

Definition at line 562 of file proto.h.

◆ varint() [3/4]

static constexpr uint32_t ESPHOME_ALWAYS_INLINE esphome::api::ProtoSize::varint ( uint32_t value)
inlinestaticconstexpr

Calculates the size in bytes needed to encode a uint32_t value as a varint.

Parameters
valueThe uint32_t value to calculate size for
Returns
The number of bytes needed to encode the value

Definition at line 486 of file proto.h.

◆ varint() [4/4]

static constexpr uint32_t esphome::api::ProtoSize::varint ( uint64_t value)
inlinestaticconstexpr

Calculates the size in bytes needed to encode a uint64_t value as a varint.

Parameters
valueThe uint64_t value to calculate size for
Returns
The number of bytes needed to encode the value

Definition at line 515 of file proto.h.


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