UniRec 3.3.2
|
Provides a view into a UniRec record. More...
#include <unirecRecordView.hpp>
Public Member Functions | |
UnirecRecordView (const void *unirecRecordData, ur_template_t *unirecTemplate, uint64_t sequenceNumber=0) | |
Constructs a UnirecRecordView object. | |
const void * | data () const noexcept |
Returns a const pointer to the data of the UniRec record. | |
size_t | size () const noexcept |
Returns the size of the UniRec record. | |
uint64_t | getSequenceNumber () const noexcept |
Gets the sequence number of the record. | |
template<typename T > | |
add_const_t< T > | getFieldAsType (ur_field_id_t fieldID) const |
Gets the value of a field as a type T. | |
template<typename T > | |
add_const_t< UnirecArray< T > > | getFieldAsUnirecArray (ur_field_id_t fieldID) const |
Gets the value of a field as a UnirecArray. | |
Private Member Functions | |
template<typename T > | |
add_const_t< T > | getFieldAsStringType (ur_field_id_t fieldID) const |
Private Attributes | |
const void * | m_recordData |
ur_template_t * | m_unirecTemplate |
uint64_t | m_sequenceNumber |
Friends | |
class | UnirecRecord |
Provides a view into a UniRec record.
The UnirecRecordView
class offers a lightweight way to access and inspect the contents of a UniRec record. It provides methods for retrieving field values as various types, including arrays, strings, and other fundamental types. The class does not own the record data and is intended for read-only operations.
Definition at line 40 of file unirecRecordView.hpp.
|
inline |
Constructs a UnirecRecordView object.
unirecRecordData | Pointer to the UniRec record data. |
unirecTemplate | Pointer to the UniRec template for the record. |
sequenceNumber | The sequence number of the record. |
Definition at line 48 of file unirecRecordView.hpp.
Returns a const pointer to the data of the UniRec record.
Definition at line 60 of file unirecRecordView.hpp.
|
inlineprivate |
Definition at line 169 of file unirecRecordView.hpp.
|
inline |
Gets the value of a field as a type T.
This function retrieves the value of a field and converts it to the specified type T
. It performs type checking to ensure that the field type matches the expected type.
T | The type of the field to get. |
fieldID | The ID of the field to get. |
T
object. std::runtime_error | If the field type does not match the expected type. |
Definition at line 117 of file unirecRecordView.hpp.
|
inline |
Gets the value of a field as a UnirecArray.
This function retrieves the value of a field as a UnirecArray
object, which provides a view into a contiguous array of values associated with the specified unirec field ID.
T | The element type of the array. |
fieldID | The ID of the field to get. |
UnirecArray<T>
object representing the array.Definition at line 159 of file unirecRecordView.hpp.
|
inlinenoexcept |
Gets the sequence number of the record.
The sequence number represents the order of UniRec records when they are processed. Sequential numbers are currently supported by libtrap only for the Unix socket interface. If there is a gap between sequential numbers, it indicates data loss, which can occur when the internal buffers overflow due to the data not being retrieved in a timely manner. A sequential number of 0 signifies that sequential numbering is not supported. Sequential numbers start from 1 and increase for each new record.
Definition at line 83 of file unirecRecordView.hpp.
|
inlinenoexcept |
Returns the size of the UniRec record.
Definition at line 67 of file unirecRecordView.hpp.
|
friend |
Definition at line 180 of file unirecRecordView.hpp.
Definition at line 176 of file unirecRecordView.hpp.
|
private |
Definition at line 178 of file unirecRecordView.hpp.
|
private |
Definition at line 177 of file unirecRecordView.hpp.