microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers > Struct Template Reference

Compile-time register field queried through typed callbacks. More...

#include <register_context.hpp>

Public Types

using state_type = State
 
using value_type = Value
 

Static Public Member Functions

static constexpr bool matches (uint32_t index) noexcept
 
static bool read (const state_type &state, address_space_ref space, uint32_t index, value_type &value) noexcept
 
template<auto Callback = WriteCallback, typename std::enable_if< Callback !=nullptr, int >::type = 0>
static bool write (state_type &state, address_space_ref space, uint32_t index, const value_type &value) noexcept
 

Detailed Description

template<typename State, typename Value, auto ReadCallback, auto WriteCallback, uint32_t... Registers>
struct microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >

Compile-time register field queried through typed callbacks.

This supports registers that are not stored in the bound state, including values read directly from hardware. Passing nullptr as WriteCallback creates a read-only field.

Template Parameters
StateBound context state.
ValueRegister value type.
ReadCallbackNothrow callback that reads a register value.
WriteCallbackNothrow callback that writes a register value, or nullptr.
RegistersRegister indexes handled by the callbacks.

Member Typedef Documentation

◆ state_type

template<typename State , typename Value , auto ReadCallback, auto WriteCallback, uint32_t... Registers>
using microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >::state_type = State

◆ value_type

template<typename State , typename Value , auto ReadCallback, auto WriteCallback, uint32_t... Registers>
using microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >::value_type = Value

Member Function Documentation

◆ matches()

template<typename State , typename Value , auto ReadCallback, auto WriteCallback, uint32_t... Registers>
static constexpr bool microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >::matches ( uint32_t  index)
inlinestaticconstexprnoexcept

◆ read()

template<typename State , typename Value , auto ReadCallback, auto WriteCallback, uint32_t... Registers>
static bool microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >::read ( const state_type &  state,
address_space_ref  space,
uint32_t  index,
value_type &  value 
)
inlinestaticnoexcept

◆ write()

template<typename State , typename Value , auto ReadCallback, auto WriteCallback, uint32_t... Registers>
template<auto Callback = WriteCallback, typename std::enable_if< Callback !=nullptr, int >::type = 0>
static bool microfmt::register_callback_field< State, Value, ReadCallback, WriteCallback, Registers >::write ( state_type &  state,
address_space_ref  space,
uint32_t  index,
const value_type &  value 
)
inlinestaticnoexcept

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