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

Read view of one value in a CompositeArray. More...

#include <Composite.hpp>

+ Collaboration diagram for MayaFlux::Kakshya::Composite:

Public Member Functions

std::optional< std::span< const uint8_t > > blob (std::string_view field_name) const noexcept
 Borrow the bytes of a fixed or dynamic BLOB field.
 
template<typename T >
requires ArithmeticData<T>
std::optional< T > get (std::string_view field_name) const noexcept
 Read a present arithmetic field by exact value type.
 
bool has (std::string_view field_name) const noexcept
 Whether a named field exists and is present in this element.
 
const CompositeLayout & layout () const noexcept
 Layout used to interpret this element's packed bytes.
 
std::optional< std::string_view > text (std::string_view field_name) const noexcept
 Read a present std::string field as borrowed UTF-8 bytes.
 
std::optional< CompositeValue > value (std::string_view field_name) const noexcept
 Borrow a dynamic value; an absent field returns std::nullopt.
 

Private Member Functions

 Composite (const CompositeLayout &layout, const DataVariant &rows, const DataVariant &text, const DataVariant &blob, size_t index) noexcept
 

Private Attributes

const DataVariant * m_blob
 
size_t m_index
 
const CompositeLayout * m_layout
 
const DataVariant * m_rows
 
const DataVariant * m_text
 

Friends

class CompositeAccess
 
class CompositeArray
 
class CompositeInsertion
 

Detailed Description

Read view of one value in a CompositeArray.

Borrows a layout and three DataVariant stores. Arithmetic access copies one value from packed bytes, so the field need not be naturally aligned. Numeric getters require an exact declared type, except dynamic INTEGER and REAL fields which accept int64_t and double respectively. Missing and mismatched fields return std::nullopt.

Usage:

auto item = items.at(0);
auto name = item->text("name");
auto score = item->get<double>("score");
bool has_age = item->has("age");
std::string name
Definition VKDevice.cpp:123
int64_t score
Definition VKDevice.cpp:138
Note
The backing layout and DataVariant objects must outlive this view. Text and byte views may be invalidated by later writes to their stores.

Definition at line 130 of file Composite.hpp.


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