ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
esphome::ChainLink< Next, Owner > Class Template Reference

One pointer per node that holds the next node of a chain, or on the last node the chain's owner. More...

#include <chain.h>

Public Member Functions

bool is_owner () const
 
Next * next () const
 The next node, or nullptr on the last one.
 
Owner * owner () const
 Only valid when is_owner().
 
Next ** next_slot ()
 Where the next node goes, for appending without a branch; only valid when !is_owner().
 
void set_next (Next *next)
 
void set_owner (Owner *owner)
 Makes this the last node.
 
void set (Next *next, Owner *owner)
 Link to next, or to owner when next is nullptr.
 

Static Public Member Functions

static Next * tagged (Owner *owner)
 The value set_owner() stores, for writing through next_slot(). The owner is never null.
 

Protected Attributes

Next * ptr_ {nullptr}
 

Static Protected Attributes

static constexpr uintptr_t OWNER_TAG = 1
 

Detailed Description

template<typename Next, typename Owner>
class esphome::ChainLink< Next, Owner >

One pointer per node that holds the next node of a chain, or on the last node the chain's owner.

The owner is tagged in the low bit, so it needs an alignment of at least 2. A chain may also end in nullptr, with no owner.

Definition at line 12 of file chain.h.

Member Function Documentation

◆ is_owner()

template<typename Next , typename Owner >
bool esphome::ChainLink< Next, Owner >::is_owner ( ) const
inline

Definition at line 14 of file chain.h.

◆ next()

template<typename Next , typename Owner >
Next * esphome::ChainLink< Next, Owner >::next ( ) const
inline

The next node, or nullptr on the last one.

Definition at line 16 of file chain.h.

◆ next_slot()

template<typename Next , typename Owner >
Next ** esphome::ChainLink< Next, Owner >::next_slot ( )
inline

Where the next node goes, for appending without a branch; only valid when !is_owner().

Definition at line 20 of file chain.h.

◆ owner()

template<typename Next , typename Owner >
Owner * esphome::ChainLink< Next, Owner >::owner ( ) const
inline

Only valid when is_owner().

Definition at line 18 of file chain.h.

◆ set()

template<typename Next , typename Owner >
void esphome::ChainLink< Next, Owner >::set ( Next * next,
Owner * owner )
inline

Link to next, or to owner when next is nullptr.

Definition at line 39 of file chain.h.

◆ set_next()

template<typename Next , typename Owner >
void esphome::ChainLink< Next, Owner >::set_next ( Next * next)
inline

Definition at line 24 of file chain.h.

◆ set_owner()

template<typename Next , typename Owner >
void esphome::ChainLink< Next, Owner >::set_owner ( Owner * owner)
inline

Makes this the last node.

Definition at line 29 of file chain.h.

◆ tagged()

template<typename Next , typename Owner >
static Next * esphome::ChainLink< Next, Owner >::tagged ( Owner * owner)
inlinestatic

The value set_owner() stores, for writing through next_slot(). The owner is never null.

Definition at line 31 of file chain.h.

Field Documentation

◆ OWNER_TAG

template<typename Next , typename Owner >
uintptr_t esphome::ChainLink< Next, Owner >::OWNER_TAG = 1
staticconstexprprotected

Definition at line 48 of file chain.h.

◆ ptr_

template<typename Next , typename Owner >
Next* esphome::ChainLink< Next, Owner >::ptr_ {nullptr}
protected

Definition at line 50 of file chain.h.


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