ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib.structure Module Reference

Concepts

concept  lib::detail::is_record_like
concept  lib::detail::is_structure_like

Data Structures

struct  lib::detail::all_byte_spans< T >
struct  lib::detail::all_byte_spans< std::tuple< Ss... > >
struct  lib::detail::all_slices< T >
struct  lib::detail::all_slices< std::tuple< Ss... > >
class  lib::array_proxy< ElementType, Count, IsConst, IsMMIO, StructEndian >
struct  lib::detail::bank_count_of< Loc >
struct  lib::detail::bank_count_of< bank< Count, Stride > >
class  lib::bank_proxy< ElementType, Count, Stride, IsConst, IsMMIO, StructEndian >
struct  lib::detail::bank_stride_of< Loc >
struct  lib::detail::bank_stride_of< bank< Count, Stride > >
struct  lib::detail::computed_layout_meta< N >
struct  lib::detail::fold_max_end_byte< Tuple >
struct  lib::detail::fold_max_end_byte< std::tuple< Sls... > >
struct  lib::detail::fold_min_byte_offset< Tuple >
struct  lib::detail::fold_min_byte_offset< std::tuple< Sls... > >
struct  lib::detail::fold_min_span_byte< Tuple >
struct  lib::detail::fold_min_span_byte< std::tuple< Sps... > >
struct  lib::detail::fold_slice_width< Tuple >
struct  lib::detail::fold_slice_width< std::tuple< Sls... > >
struct  lib::detail::fold_span_size_sum< Tuple >
struct  lib::detail::fold_span_size_sum< std::tuple< Sps... > >
struct  lib::detail::is_auto_tag< T >
struct  lib::detail::is_auto_tag< auto_layout >
struct  lib::detail::is_bank_tag< T >
struct  lib::detail::is_bank_tag< bank< C, S > >
struct  lib::detail::is_bitfield_trait< T >
struct  lib::detail::is_bitfield_trait< bit_field< T, Num > >
struct  lib::detail::is_byte_span< T >
struct  lib::detail::is_byte_span< byte_span< S, E > >
struct  lib::detail::is_slice< T >
struct  lib::detail::is_slice< slice< O, A, B, N > >
struct  lib::structure_layout_info< Extent, Alignment, StructEndian, FieldOrExts >::layout_holder< Tuple >
struct  lib::structure_layout_info< Extent, Alignment, StructEndian, FieldOrExts >::layout_holder< std::tuple< Fs... > >
struct  lib::detail::loc_slices< L >
struct  lib::detail::loc_slices< slice< O, A, B, N > >
struct  lib::detail::loc_slices< std::tuple< Ss... > >
struct  lib::detail::loc_spans< L >
struct  lib::detail::loc_spans< std::tuple< Ss... > >
struct  lib::detail::map_structure_fields< Tuple >
struct  lib::detail::map_structure_fields< std::tuple< Fs... > >
class  lib::mmio_structure_ref< Extent, Alignment, StructEndian, FieldOrExts >
struct  lib::detail::span_size_of< Loc >
struct  lib::detail::span_size_of< byte_span< S, E > >
class  lib::structure< Extent, Alignment, StructEndian, FieldOrExts >
struct  lib::structure_field_view< Field >
 Structure-domain resolution of a unified field. More...
class  lib::structure_impl< Extent, Alignment, StructEndian, IsMMIO, FieldOrExts >
struct  lib::structure_layout_info< Extent, Alignment, StructEndian, FieldOrExts >
class  lib::structure_ref< Extent, Alignment, StructEndian, FieldOrExts >
class  lib::structure_span< StructT, IsMMIO >
 Zero-overhead span of structures over contiguous memory. More...
struct  lib::structure_traits< StructT >
struct  lib::structure_traits< structure< Extent, Alignment, StructEndian, FieldOrExts... > >
struct  std::tuple_element< I, lib::structure< Extent, Alignment, StructEndian, FieldOrExts... > >
struct  std::tuple_size< lib::structure< Extent, Alignment, StructEndian, FieldOrExts... > >

Typedefs

template<fixed_string Name, class ElementType, usize Count, usize Stride = sizeof(ElementType)>
using lib::bank_array = field<Name, bank<Count, Stride>, ElementType, attr::rw>
template<fixed_string Name, usize Alignment, class... Slices>
using lib::cross_aligned_rw_field = field<Name, std::tuple<Slices...>, u64, attr::rw, attr::aligned<Alignment> >
template<fixed_string Name, class Type, class... Slices>
using lib::cross_ro_field = field<Name, std::tuple<Slices...>, Type, attr::ro>
template<fixed_string Name, class Type, class... Slices>
using lib::cross_rw_field = field<Name, std::tuple<Slices...>, Type, attr::rw>
template<usize ByteOffset, usize StartBit, usize EndBit, class Numbering = msb0_t>
using lib::cross_slice = lib::slice<ByteOffset, StartBit, EndBit, Numbering>
template<fixed_string Name, class Type, class... Spans>
using lib::disjoint_ro_byte = field<Name, std::tuple<Spans...>, Type, attr::ro>
template<fixed_string Name, class Type, class... Spans>
using lib::disjoint_rw_byte = field<Name, std::tuple<Spans...>, Type, attr::rw>
using element_ref
using element_type = std::conditional_t<is_array, std::remove_all_extents_t<value_type>, value_type>
using field_tuple = typename detail::map_structure_fields<raw_field_tuple>::type
using Layout = structure_layout_info<Extent, Alignment, StructEndian, FieldOrExts...>
using loc = typename Field::locator
using mmio_ref_type = mmio_structure_ref<Extent, Alignment, StructEndian, FieldOrExts...>
using mmio_ref_type = mmio_structure_ref<Extent, Alignment, StructEndian, FieldOrExts...>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::overlay_ro_byte = field<Name, byte_span<Start, End>, Type, attr::ro, attr::overlay>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::overlay_rw_byte = field<Name, byte_span<Start, End>, Type, attr::rw, attr::overlay>
using pointer_type = std::conditional_t<IsConst, const ElementType *, ElementType *>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::rao_byte = field<Name, byte_span<Start, End>, Type, attr::rao>
template<fixed_string Name, class Type>
using lib::rao_byte_auto = field<Name, auto_layout, Type, attr::rao>
using raw_field_tuple = typename detail::filter_fields<FieldOrExts...>::type
template<fixed_string Name, usize Start, usize End, class Type>
using lib::raz_byte = field<Name, byte_span<Start, End>, Type, attr::raz>
template<fixed_string Name, class Type>
using lib::raz_byte_auto = field<Name, auto_layout, Type, attr::raz>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::rc_byte = field<Name, byte_span<Start, End>, Type, attr::rc>
template<fixed_string Name, class Type>
using lib::rc_byte_auto = field<Name, auto_layout, Type, attr::rc>
using ref_type = structure_ref<Extent, Alignment, StructEndian, FieldOrExts...>
using ref_type = structure_ref<Extent, Alignment, StructEndian, FieldOrExts...>
template<fixed_string Name, class ElementType, usize Count, usize Stride = sizeof(ElementType)>
using lib::ro_bank_array = field<Name, bank<Count, Stride>, ElementType, attr::ro>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::ro_byte = field<Name, byte_span<Start, End>, Type, attr::ro>
template<fixed_string Name, class Type>
using lib::ro_byte_auto = field<Name, auto_layout, Type, attr::ro>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::rw_byte = field<Name, byte_span<Start, End>, Type, attr::rw>
template<fixed_string Name, class Type>
using lib::rw_byte_auto = field<Name, auto_layout, Type, attr::rw>
template<fixed_string Name, usize Start, usize End, class Type = u8>
using lib::rz_byte = field<Name, byte_span<Start, End>, Type, attr::rz>
template<fixed_string Name, class Type = u8>
using lib::rz_byte_auto = field<Name, auto_layout, Type, attr::rz>
using slices = typename detail::loc_slices<loc>::type
using spans = typename detail::loc_spans<loc>::type
template<class StructT>
using lib::structure_as_mmio_ref_t = typename structure_traits<StructT>::mmio_ref_type
template<class StructT>
using lib::structure_as_ref_t = typename structure_traits<StructT>::ref_type
using type = std::tuple<>
using type = std::tuple<slice<O, A, B, N> >
using type = std::tuple<Ss...>
using type = std::tuple<>
using type = std::tuple<Ss...>
using type = std::tuple<structure_field_view<Fs>...>
using type = typename Field::value_type
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_ro_byte = field<Name, byte_span<Start, End>, Type, attr::ro, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_rw_byte = field<Name, byte_span<Start, End>, Type, attr::rw, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_w0c_byte = field<Name, byte_span<Start, End>, Type, attr::w0c, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_w1c_byte = field<Name, byte_span<Start, End>, Type, attr::w1c, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_w1s_byte = field<Name, byte_span<Start, End>, Type, attr::w1s, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_w1t_byte = field<Name, byte_span<Start, End>, Type, attr::w1t, attr::unaligned>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::unaligned_wo_byte = field<Name, byte_span<Start, End>, Type, attr::wo, attr::unaligned>
using value_type = typename Field::type
template<fixed_string Name, usize Start, usize End, class Type>
using lib::w0c_byte = field<Name, byte_span<Start, End>, Type, attr::w0c>
template<fixed_string Name, class Type>
using lib::w0c_byte_auto = field<Name, auto_layout, Type, attr::w0c>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::w1c_byte = field<Name, byte_span<Start, End>, Type, attr::w1c>
template<fixed_string Name, class Type>
using lib::w1c_byte_auto = field<Name, auto_layout, Type, attr::w1c>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::w1s_byte = field<Name, byte_span<Start, End>, Type, attr::w1s>
template<fixed_string Name, class Type>
using lib::w1s_byte_auto = field<Name, auto_layout, Type, attr::w1s>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::w1t_byte = field<Name, byte_span<Start, End>, Type, attr::w1t>
template<fixed_string Name, class Type>
using lib::w1t_byte_auto = field<Name, auto_layout, Type, attr::w1t>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::wac_byte = field<Name, byte_span<Start, End>, Type, attr::wac>
template<fixed_string Name, class Type>
using lib::wac_byte_auto = field<Name, auto_layout, Type, attr::wac>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::wo_byte = field<Name, byte_span<Start, End>, Type, attr::wo>
template<fixed_string Name, class Type>
using lib::wo_byte_auto = field<Name, auto_layout, Type, attr::wo>
template<fixed_string Name, usize Start, usize End, class Type>
using lib::woo_byte = field<Name, byte_span<Start, End>, Type, attr::woo>
template<fixed_string Name, class Type>
using lib::woo_byte_auto = field<Name, auto_layout, Type, attr::woo>

Functions

template<class ValT, class FieldEndian, class StructEndian>
constexpr auto lib::detail::adjust_endian_on_read (ValT val) noexcept -> ValT
template<class ValT, class FieldEndian, class StructEndian>
constexpr auto lib::detail::adjust_endian_on_write (ValT val) noexcept -> ValT
constexpr void apply_default_values () noexcept
 Materialize init<>/fixed<> default values into raw storage.
constexpr array_proxy (u8 *base_ptr) noexcept
constexpr auto as_bytes (this auto &self) noexcept -> std::span< u8, extent >
constexpr auto as_bytes (this const auto &self) noexcept -> std::span< const u8, extent >
template<fixed_string Name, class ValT>
auto atomic_compare_exchange (ValT &expected, ValT desired, std::memory_order success=std::memory_order_seq_cst, std::memory_order failure=std::memory_order_seq_cst) const noexcept -> bool
template<fixed_string Name>
auto atomic_load (std::memory_order order=std::memory_order_seq_cst) const noexcept
template<fixed_string Name, class ValT>
auto atomic_store (ValT &&val, std::memory_order order=std::memory_order_seq_cst) const noexcept -> void
constexpr bank_proxy (u8 *base_ptr) noexcept
constexpr auto begin () const noexcept -> pointer_type
template<usize Extent, usize Alignment, class... Fields>
consteval auto lib::detail::calculate_structure_layout ()
constexpr auto data () const noexcept -> pointer_type
constexpr auto data () const noexcept -> u8 *
constexpr auto end () const noexcept -> pointer_type
template<fixed_string Path>
constexpr decltype(auto) get (this auto &&self) noexcept
template<fixed_string Name>
static consteval auto index_of () noexcept -> usize
template<fixed_string... FieldNames, class... Values>
static constexpr auto make (Values &&... vals) noexcept -> structure
constexpr auto mmio_ref () noexcept -> mmio_ref_type
constexpr mmio_structure_ref (volatile void *ptr) noexcept
template<fixed_string Name>
static consteval auto offset_of () noexcept -> usize
constexpr auto operator= (const structure &other) noexcept -> structure &
constexpr auto operator[] (usize idx) const noexcept -> ElementType
constexpr auto operator[] (usize idx) const noexcept
template<fixed_string Name>
constexpr decltype(auto) operator[] (this auto &&self, field_tag< Name >) noexcept
constexpr auto operator[] (usize index) const noexcept -> element_ref
constexpr auto raw_ptr () const noexcept -> const u8 *
constexpr auto raw_ptr () noexcept -> u8 *
constexpr auto raw_ptr () const noexcept -> const u8 *
constexpr auto raw_ptr () noexcept -> u8 *
constexpr auto raw_ptr () const noexcept -> const u8 *
constexpr auto raw_ptr () noexcept -> u8 *
template<class T>
constexpr auto raw_read (this const auto &self, usize byte_offset) noexcept -> T
template<class T>
constexpr auto raw_write (this auto &&self, usize byte_offset, T val) noexcept -> void
constexpr auto ref () noexcept -> ref_type
template<class Loc, class Slices, class Spans, bool IsCross, bool IsDisjoint, bool IsByte>
consteval auto lib::detail::resolve_start () noexcept -> usize
template<class Loc, class Slices, class Spans, class ElementType, bool IsCross, bool IsDisjoint, bool IsByte, bool IsBank>
consteval auto lib::detail::resolve_total_size () noexcept -> usize
template<class Slices, bool IsCross>
consteval auto lib::detail::resolve_total_width () noexcept -> usize
constexpr auto set (usize idx, ElementType val) const noexcept -> void
template<class ValT>
requires (!IsConst)
constexpr auto set (usize idx, ValT &&val) const noexcept -> void
template<fixed_string Path, class ValT>
constexpr decltype(auto) set (this auto &&self, ValT &&val) noexcept
constexpr auto size () const noexcept -> usize
constexpr auto size () const noexcept -> usize
constexpr auto size () const noexcept -> usize
template<fixed_string Name>
static consteval auto size_of () noexcept -> usize
constexpr auto stride () const noexcept -> usize
template<class... Bindings>
requires (sizeof...(Bindings) > 0 && ((requires { Bindings::name; }) && ...))
constexpr structure (Bindings &&... bindings) noexcept
constexpr structure (const structure &other) noexcept
constexpr structure_ref (void *ptr) noexcept
constexpr structure_span (void *base_ptr, usize count=static_cast< usize >(-1)) noexcept
constexpr auto try_at (usize index) const noexcept -> std::expected< element_ref, kernel_error >
constexpr auto try_get (usize idx) const noexcept -> std::expected< ElementType, kernel_error >
template<class T>
constexpr auto try_raw_read (this const auto &self, usize byte_offset) noexcept -> std::expected< T, kernel_error >
template<class T>
constexpr auto try_raw_write (this auto &&self, usize byte_offset, T val) noexcept -> std::expected< void, kernel_error >
constexpr auto try_set (usize idx, ElementType val) const noexcept -> std::expected< void, kernel_error >

Variables

static constexpr usize alignment = Field::is_unaligned ? 1 : alignof(element_type)
static constexpr usize alignment = Layout::alignment
static constexpr usize alignment = meta.max_alignment
static constexpr usize alignment = Alignment
static constexpr usize array_count = is_array ? std::extent_v<value_type> : 1
static constexpr usize count = detail::bank_count_of<loc>::value
static constexpr usize declared_span_size = detail::span_size_of<loc>::value
static constexpr usize extent = Layout::extent
static constexpr usize extent = (Extent != 0) ? Extent : meta.total_extent
static constexpr usize extent = Extent
static constexpr usize field_count = Layout::field_count
static constexpr usize field_count = std::tuple_size_v<field_tuple>
bool has_overlap = false
static constexpr bool is_array = std::is_bounded_array_v<value_type>
static constexpr bool is_auto = loc_is_auto && !is_bank
static constexpr bool is_bank = loc_is_bank
template<class T>
constexpr bool lib::detail::is_bitfield_v = is_bitfield_trait<std::remove_cvref_t<T> >::value
static constexpr bool is_cross = loc_is_slice || loc_multi_slice
static constexpr bool is_disjoint = loc_multi_span
static constexpr bool is_pinned = loc_is_byte || loc_is_slice || loc_multi_slice || loc_multi_span
template<class T>
constexpr bool lib::detail::is_record_v = is_record_like<T>
template<class T>
constexpr bool lib::detail::is_structure_v = is_structure_like<T>
static constexpr auto layout_meta = Layout::meta
static constexpr bool loc_is_auto = detail::is_auto_tag<loc>::value
static constexpr bool loc_is_bank = detail::is_bank_tag<loc>::value
static constexpr bool loc_is_byte = detail::is_byte_span<loc>::value
static constexpr bool loc_is_slice = detail::is_slice<loc>::value
static constexpr bool loc_multi_slice = detail::all_slices<loc>::value
static constexpr bool loc_multi_span = detail::all_byte_spans<loc>::value
usize max_alignment = 1
static constexpr auto meta = detail::calculate_structure_layout<Extent, Alignment, Fs...>()
static constexpr auto meta = layout_holder<field_tuple>::meta
std::array< std::string_view, N > names {}
std::array< usize, N > offsets {}
std::array< usize, N > sizes {}
static constexpr usize start
static constexpr usize stride = detail::bank_stride_of<loc>::value
usize total_extent = 0
static constexpr usize total_size
static constexpr usize total_width = detail::resolve_total_width<slices, is_cross>()
static constexpr usize value = 1
static constexpr usize value = Count
static constexpr usize value = 0
static constexpr usize value = Stride
static constexpr usize value = 0
static constexpr usize value = std::max({Sls::end_byte...})
static constexpr usize value = 0
static constexpr usize value = std::min({Sls::byte_offset...})
static constexpr usize value = 0
static constexpr usize value = std::min({Sps::min_byte...})
static constexpr usize value = 0
static constexpr usize value = (Sls::width + ...)
static constexpr usize value = 0
static constexpr usize value = (Sps::size + ...)
static constexpr usize value = 0
static constexpr usize value = byte_span<S, E>::size

Files

file  lib/structure.cxxm
 C++26 memory-mapped structure framework built on the unified field.