MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ add_field()

template<typename T>
requires (ArithmeticData<T> || GlmType<T> || std::same_as<std::remove_cvref_t<T>, std::string> || std::same_as<std::remove_cvref_t<T>, std::vector<uint8_t>>)
bool MayaFlux::Kakshya::CompositeLayout::add_field ( std::string name)
inline

Declare a named arithmetic, GLM, text, or binary field.

Template Parameters
TExact stored type; use std::string for text or std::vector<uint8_t> for binary bytes.
Parameters
nameNonempty unique field name.
Returns
True if added; false if the name is invalid, duplicated, or the layout has already been finalized.

Definition at line 74 of file Composite.hpp.

75 {
76 if constexpr (std::same_as<std::remove_cvref_t<T>, std::string>
77 || std::same_as<std::remove_cvref_t<T>, std::vector<uint8_t>>) {
78 return add_field_impl(std::move(name), typeid(T), 2 * sizeof(uint64_t));
79 } else {
80 static_assert(std::is_trivially_copyable_v<T>);
81 return add_field_impl(std::move(name), typeid(T), sizeof(T));
82 }
83 }
bool add_field_impl(std::string name, std::type_index type, size_t size_bytes)
Definition Composite.cpp:33

References add_field_impl().

Referenced by MayaFlux::Kakshya::CompositeFieldCodec< std::string >::add(), MayaFlux::Kakshya::CompositeFieldCodec< std::vector< uint8_t > >::add(), MayaFlux::Kakshya::CompositeFieldCodec< T >::add(), MayaFlux::IO::DelimitedTextReader::open(), MayaFlux::Yantra::phoneme_record_layout(), and MayaFlux::IO::xml_composite_layout().

Here is the call graph for this function:
Here is the caller graph for this function: