MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::CompositeLayout Class Reference

Shared field description and byte layout for a CompositeArray. More...

#include <Composite.hpp>

+ Collaboration diagram for MayaFlux::Kakshya::CompositeLayout:

Public Member Functions

bool add_dynamic_field (std::string name)
 Declare a field with a per-element NULL, INTEGER, REAL, TEXT, or BLOB kind.
 
template<typename T >
requires (ArithmeticData<T> || std::same_as<std::remove_cvref_t<T>, std::string> || std::same_as<std::remove_cvref_t<T>, std::vector<uint8_t>>)
bool add_field (std::string name)
 Declare a named arithmetic, text, or binary field.
 
const std::vector< CompositeField > & fields () const noexcept
 Declared fields in element order, with finalized byte offsets.
 
std::optional< size_t > find_field (std::string_view name) const noexcept
 Find a field index by name, or std::nullopt if absent.
 
size_t presence_bytes () const noexcept
 Bytes reserved for the per-element presence bitmap.
 
size_t stride_bytes () const noexcept
 Bytes per packed element after finalization.
 

Private Member Functions

bool add_field_impl (std::string name, std::type_index type, size_t size_bytes)
 
void finalize ()
 

Private Attributes

std::vector< CompositeField > m_fields
 
bool m_finalized {}
 
size_t m_presence_bytes {}
 
size_t m_stride_bytes {}
 

Friends

class CompositeArray
 

Detailed Description

Shared field description and byte layout for a CompositeArray.

Declare fields before constructing an array. Construction finalizes the layout, placing a presence bitmap before the fields in each element. Field order determines byte offsets. A field may be an arithmetic type, std::string, binary bytes, or a dynamic value.

Usage:

layout.add_field<std::string>("name");
layout.add_field<uint32_t>("age");
layout.add_field<double>("score");
CompositeArray items(std::move(layout));
Owns a sequence of values that share a CompositeLayout.
bool add_field(std::string name)
Declare a named arithmetic, text, or binary field.
Definition Composite.hpp:65
Shared field description and byte layout for a CompositeArray.
Definition Composite.hpp:52
Note
stride_bytes() and field offsets are final only after construction of a CompositeArray from this layout.

Definition at line 52 of file Composite.hpp.


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