ADTF
LeafValueGetter< ValueType >

Value getter to retrieve the current value of the given element as a ValueType if supported from a data area. More...

Static Public Member Functions

static ValueType getValue (const void *data, const size_t data_size, const LeafLayout &leaf_layout)
 Returns the current value of the given element as a ValueType if supported. More...
 

Detailed Description

template<typename ValueType>
struct ddl::codec::LeafValueGetter< ValueType >

Value getter to retrieve the current value of the given element as a ValueType if supported from a data area.

Template Parameters
ValueTypeThe value type supported (by default bool, all int types, float, double and std::string are supported).
Remarks
If you want to support your own data type, then create a specialization of this template.

Definition at line 861 of file leaf_value_access.h.

Member Function Documentation

◆ getValue()

static ValueType getValue ( const void *  data,
const size_t  data_size,
const LeafLayout leaf_layout 
)
inlinestatic

Returns the current value of the given element as a ValueType if supported.

Parameters
leaf_layoutThe small leaf layout of the element to get.
dataThe data area to retrieve the value from
data_sizeThe data area size in bytes
Returns
ValueType Returns the current value as ValueType if supported.
Exceptions
std::runtime_errorif there is no valid conversion or the given layout is invalid

Definition at line 870 of file leaf_value_access.h.

References LeafLayout::data_flags, and ddl::codec::serialized.

Referenced by StaticDecoder::getElementValue(), and ValueGetterSelect< DecoderType, ValueType, true >::getValue().