ESPHome  2024.11.3
Public Member Functions | Protected Attributes
esphome::CallbackManager< void(Ts...)> Class Template Reference

Helper class to allow having multiple subscribers to a callback. More...

#include <helpers.h>

Public Member Functions

void add (std::function< void(Ts...)> &&callback)
 Add a callback to the list. More...
 
void call (Ts... args)
 Call all callbacks in this manager. More...
 
size_t size () const
 
void operator() (Ts... args)
 Call all callbacks in this manager. More...
 

Protected Attributes

std::vector< std::function< void(Ts...)> > callbacks_
 

Detailed Description

template<typename... Ts>
class esphome::CallbackManager< void(Ts...)>

Helper class to allow having multiple subscribers to a callback.

Template Parameters
TsThe arguments for the callbacks, wrapped in void().

Definition at line 489 of file helpers.h.

Member Function Documentation

◆ add()

template<typename... Ts>
void esphome::CallbackManager< void(Ts...)>::add ( std::function< void(Ts...)> &&  callback)
inline

Add a callback to the list.

Definition at line 492 of file helpers.h.

◆ call()

template<typename... Ts>
void esphome::CallbackManager< void(Ts...)>::call ( Ts...  args)
inline

Call all callbacks in this manager.

Definition at line 495 of file helpers.h.

◆ operator()()

template<typename... Ts>
void esphome::CallbackManager< void(Ts...)>::operator() ( Ts...  args)
inline

Call all callbacks in this manager.

Definition at line 502 of file helpers.h.

◆ size()

template<typename... Ts>
size_t esphome::CallbackManager< void(Ts...)>::size ( ) const
inline

Definition at line 499 of file helpers.h.

Field Documentation

◆ callbacks_

template<typename... Ts>
std::vector<std::function<void(Ts...)> > esphome::CallbackManager< void(Ts...)>::callbacks_
protected

Definition at line 505 of file helpers.h.


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