CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::plugin_manager::SlotTable< T, N > Struct Template Reference

#include <SlotTable.h>

Public Member Functions

T * lookup (int id)
 1-based lookup. Returns nullptr if id is out of range or slot unused.
T * allocate (int &out_id)

Static Public Member Functions

static constexpr std::size_t capacity ()

Public Attributes

std::array< T, N > slots {}

Detailed Description

template<typename T, std::size_t N>
struct cdc::plugin_manager::SlotTable< T, N >

Definition at line 20 of file SlotTable.h.

Member Function Documentation

◆ allocate()

template<typename T, std::size_t N>
T * cdc::plugin_manager::SlotTable< T, N >::allocate ( int & out_id)
inline

First-fit allocate. Returns the slot and writes 1-based id to out_id. Returns nullptr if the table is full; out_id is set to 0 in that case. Does NOT mark the slot used - caller initialises the slot then sets used = true once setup succeeds.

Definition at line 37 of file SlotTable.h.

References slots.

Referenced by host_event_subscribe(), host_http_open(), and host_socket_open().

◆ capacity()

template<typename T, std::size_t N>
constexpr std::size_t cdc::plugin_manager::SlotTable< T, N >::capacity ( )
inlinestaticconstexpr

Definition at line 23 of file SlotTable.h.

◆ lookup()

template<typename T, std::size_t N>
T * cdc::plugin_manager::SlotTable< T, N >::lookup ( int id)
inline

1-based lookup. Returns nullptr if id is out of range or slot unused.

Definition at line 26 of file SlotTable.h.

References slots.

Member Data Documentation

◆ slots

template<typename T, std::size_t N>
std::array<T, N> cdc::plugin_manager::SlotTable< T, N >::slots {}

Definition at line 21 of file SlotTable.h.

Referenced by allocate(), lookup(), plg_http_on_unload(), and plg_socket_on_unload().


The documentation for this struct was generated from the following file:
  • components/plugin_manager/include/plugin_manager/SlotTable.h