ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
esphome::DefaultBitPolicy< ValueType, MaxBits > Struct Template Reference

Default bit mapping policy for contiguous enums starting at 0 Provides 1:1 mapping where enum value equals bit position. More...

#include <finite_set_mask.h>

Public Types

using mask_t
 

Static Public Member Functions

static constexpr unsigned to_bit (ValueType value)
 
static constexpr ValueType from_bit (unsigned bit)
 

Static Public Attributes

static constexpr int MAX_BITS = MaxBits
 

Detailed Description

template<typename ValueType, int MaxBits>
struct esphome::DefaultBitPolicy< ValueType, MaxBits >

Default bit mapping policy for contiguous enums starting at 0 Provides 1:1 mapping where enum value equals bit position.

Definition at line 13 of file finite_set_mask.h.

Member Typedef Documentation

◆ mask_t

template<typename ValueType , int MaxBits>
using esphome::DefaultBitPolicy< ValueType, MaxBits >::mask_t
Initial value:
typename std::conditional<(MaxBits <= 8), uint8_t,
typename std::conditional<(MaxBits <= 16), uint16_t, uint32_t>::type>::type
uint16_t type

Definition at line 16 of file finite_set_mask.h.

Member Function Documentation

◆ from_bit()

template<typename ValueType , int MaxBits>
static constexpr ValueType esphome::DefaultBitPolicy< ValueType, MaxBits >::from_bit ( unsigned bit)
inlinestaticconstexpr

Definition at line 23 of file finite_set_mask.h.

◆ to_bit()

template<typename ValueType , int MaxBits>
static constexpr unsigned esphome::DefaultBitPolicy< ValueType, MaxBits >::to_bit ( ValueType value)
inlinestaticconstexpr

Definition at line 21 of file finite_set_mask.h.

Field Documentation

◆ MAX_BITS

template<typename ValueType , int MaxBits>
int esphome::DefaultBitPolicy< ValueType, MaxBits >::MAX_BITS = MaxBits
staticconstexpr

Definition at line 19 of file finite_set_mask.h.


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