Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
uni20::metadata_value Class Reference

An immutable owned value that retains its native scalar and optional type. More...

#include <metadata.hpp>

Public Member Functions

template<presentation::DataTableValue T>
T as () const
 Convert without a double intermediate; textual numbers use the destination's parser.
 
template<typename T >
T const & get () const
 Access the exact declared type; a mismatch throws std::bad_any_cast.
 
 metadata_value (char const *text)
 
 metadata_value (std::string_view text)
 
template<presentation::DataTableValue T>
 metadata_value (T value)
 
bool missing () const
 
std::string text (presentation::data_column_display const &format={}, bool machine=false) const
 
std::type_index type () const
 

Detailed Description

An immutable owned value that retains its native scalar and optional type.

Copies share immutable storage. Text views and C strings are copied on entry. Supported types follow presentation::DataTableValue. MPFR values retain their exact/approximate state and precision; conversion to MPFR requires explicit precision.

Constructor & Destructor Documentation

◆ metadata_value() [1/3]

template<presentation::DataTableValue T>
uni20::metadata_value::metadata_value ( T  value)
inline

◆ metadata_value() [2/3]

uni20::metadata_value::metadata_value ( std::string_view  text)
inline

◆ metadata_value() [3/3]

uni20::metadata_value::metadata_value ( char const *  text)
inline

Member Function Documentation

◆ as()

template<presentation::DataTableValue T>
T uni20::metadata_value::as ( ) const
inline

Convert without a double intermediate; textual numbers use the destination's parser.

Integer and half-integer narrowing is checked. Real rounding follows the target type; finite overflow is rejected. A real is never implicitly rounded to an integer.

◆ get()

template<typename T >
T const & uni20::metadata_value::get ( ) const
inline

Access the exact declared type; a mismatch throws std::bad_any_cast.

◆ missing()

bool uni20::metadata_value::missing ( ) const
inline

◆ text()

std::string uni20::metadata_value::text ( presentation::data_column_display const &  format = {},
bool  machine = false 
) const
inline

◆ type()

std::type_index uni20::metadata_value::type ( ) const
inline

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