116 template <
typename T>
119 using BaseType =
typename std::remove_cv_t<
120 typename std::remove_pointer_t<typename std::remove_reference_t<T>>>;
124 throw std::runtime_error(
125 "UnirecRecord data type format mismatch: " + std::string(
typeid(
T).name()));
133 }
else if constexpr (std::is_pointer_v<T>) {
135 }
else if constexpr (std::is_reference_v<T>) {
136 return *
reinterpret_cast<BaseType*
>(
158 template <
typename T>
168 template <
typename T>
Provides a view into a UniRec record.
ur_template_t * m_unirecTemplate
add_const_t< T > getFieldAsStringType(ur_field_id_t fieldID) const
uint64_t getSequenceNumber() const noexcept
Gets the sequence number of the record.
size_t size() const noexcept
Returns the size of the UniRec record.
UnirecRecordView(const void *unirecRecordData, ur_template_t *unirecTemplate, uint64_t sequenceNumber=0)
Constructs a UnirecRecordView object.
uint64_t m_sequenceNumber
const void * m_recordData
const void * data() const noexcept
Returns a const pointer to the data of the UniRec record.
add_const_t< T > getFieldAsType(ur_field_id_t fieldID) const
Gets the value of a field as a type T.
add_const_t< UnirecArray< T > > getFieldAsUnirecArray(ur_field_id_t fieldID) const
Gets the value of a field as a UnirecArray.
A class for working with UniRec records and their fields.
#define ur_rec_size(tmplt, rec)
Get size of UniRec record (static and variable length) Get total size of whole UniRec record.
#define ur_get_var_len(tmplt, rec, field_id)
Get size of a variable sized field in the record. Get size of a variable-length field in the record....
#define ur_array_get_elem_cnt(tmplt, rec, field_id)
Get number of elements stored in an UniRec array.
#define ur_get_type(field_id)
Get type of UniRec field Get type of any UniRec defined field.
#define ur_get_ptr_by_id(tmplt, data, field_id)
Get pointer to UniRec field Get pointer to fixed or varible length UniRec field. In contrast to ur_ge...
typename add_const< T >::type add_const_t
constexpr ur_field_type_t getExpectedUnirecType()
Determines the expected UniRec field type for a given C++ type T.
Header file containing the definition of the UnirecArray class and its Iterator subclass.
Provides a set of type traits and aliases for working with unirec++.
This file contains functions for determining the expected UniRec type for various C++ types.
Definition of UniRec structures and functions.
int16_t ur_field_id_t
Type of UniRec field identifiers.
UniRec template. It contains a table mapping a field to its position in an UniRec record.