UniRec 3.0.0
|
A class for working with UniRec records and their fields. More...
#include <unirecRecord.hpp>
Public Member Functions | |
UnirecRecord () | |
Default constructor. | |
UnirecRecord (ur_template_t *unirecTemplate, size_t maxVariableFieldsSize=UR_MAX_SIZE) | |
Constructor with template and maximum variable fields size. | |
void | copyFieldsFrom (const UnirecRecord &otherRecord) |
void | copyFieldsFrom (const UnirecRecordView &otherRecordView) |
~UnirecRecord () | |
Destructor. | |
const void * | data () const noexcept |
Returns a pointer to the data of the UniRec record. | |
size_t | size () const noexcept |
Returns the size of the UniRec record. | |
template<typename T > | |
T | getFieldAsType (ur_field_id_t fieldID) const |
Gets the value of a UniRec field and converts it to the specified type. | |
template<typename T > | |
UnirecArray< T > | getFieldAsUnirecArray (ur_field_id_t fieldID) |
Gets a UniRecArray representing a UniRec field. | |
template<typename T > | |
UnirecArray< T > | reserveUnirecArray (size_t elementsCount, ur_field_id_t fieldID) |
Reserves memory for a UniRecArray within a UniRec field. | |
template<typename T > | |
void | setFieldFromType (const T &fieldData, ur_field_id_t fieldID) |
Sets the value of a UniRec field using data of a specified type. | |
template<typename T > | |
void | setFieldFromUnirecArray (const UnirecArray< T > &unirecArray, ur_field_id_t fieldID) |
Sets the value of a UniRec field using a UnirecArray. | |
UnirecRecord (const UnirecRecord &other) | |
UnirecRecord & | operator= (const UnirecRecord &other) |
template<typename T > | |
void | setFieldFromVector (const std::vector< T > &sourceVector, ur_field_id_t fieldID) |
Sets the value of a UniRec array field using a vector of values. | |
Private Member Functions | |
template<typename T > | |
void | checkDataTypeCompatibility (ur_field_id_t fieldID) const |
template<typename T > | |
T | getFieldAsStringType (ur_field_id_t fieldID) const |
template<typename T > | |
T | getFieldAsPointer (ur_field_id_t fieldID) const |
template<typename T > | |
T | getFieldAsReference (ur_field_id_t fieldID) const |
template<typename T > | |
T | getFieldAsValue (ur_field_id_t fieldID) const |
void | copyFrom (const UnirecRecord &other) |
Private Attributes | |
size_t | m_recordSize |
void * | m_recordData |
ur_template_t * | m_unirecTemplate |
A class for working with UniRec records and their fields.
The UnirecRecord class facilitates the manipulation of UniRec records and their individual fields. It provides functions to access, set, and transform data within the UniRec record.
Definition at line 33 of file unirecRecord.hpp.
|
inline |
Default constructor.
Constructs an uninitialized UnirecRecord object.
Definition at line 40 of file unirecRecord.hpp.
|
inline |
Constructor with template and maximum variable fields size.
Constructs a UnirecRecord object with a specified UniRec template and maximum size for variable fields.
unirecTemplate | The UniRec template to associate with the record. |
maxVariableFieldsSize | The maximum size for variable fields in the record. |
Definition at line 56 of file unirecRecord.hpp.
|
inline |
Destructor.
Frees the memory associated with the UniRec record.
Definition at line 110 of file unirecRecord.hpp.
|
inline |
Definition at line 285 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 332 of file unirecRecord.hpp.
|
inline |
Definition at line 66 of file unirecRecord.hpp.
|
inline |
Definition at line 85 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 377 of file unirecRecord.hpp.
|
inlinenoexcept |
Returns a pointer to the data of the UniRec record.
Definition at line 117 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 360 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 366 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 352 of file unirecRecord.hpp.
|
inline |
Gets the value of a UniRec field and converts it to the specified type.
This function retrieves the value of a UniRec field, converts it to the specified type, and returns the result.
T | The type to which the field value should be converted. |
fieldID | The ID of the UniRec field. |
std::runtime_error | If there is a data type format mismatch or other error. |
Definition at line 155 of file unirecRecord.hpp.
|
inline |
Gets a UniRecArray representing a UniRec field.
This function returns a UnirecArray object representing a UniRec field that holds an array of values.
T | The type of elements in the array. |
fieldID | The ID of the UniRec field. |
Definition at line 189 of file unirecRecord.hpp.
|
inlineprivate |
Definition at line 372 of file unirecRecord.hpp.
|
inline |
Definition at line 287 of file unirecRecord.hpp.
|
inline |
Reserves memory for a UniRecArray within a UniRec field.
This function allocates memory for a UniRecArray within a UniRec field and returns a UnirecArray object that can be used to populate the field.
T | The type of elements in the array. |
elementsCount | The number of elements to allocate space for. |
fieldID | The ID of the UniRec field. |
std::runtime_error | If memory allocation fails or other errors occur. |
Definition at line 223 of file unirecRecord.hpp.
|
inline |
Sets the value of a UniRec field using data of a specified type.
This function sets the value of a UniRec field using the provided data of a specified type.
T | The type of the field data. |
fieldData | The data to set the field to. |
fieldID | The ID of the UniRec field. |
Definition at line 251 of file unirecRecord.hpp.
|
inline |
Sets the value of a UniRec field using a UnirecArray.
This function sets the value of a UniRec field in Unirec record using a UnirecArray.
T | The type of elements in the UnirecArray. |
unirecArray | The UnirecArray to set the field to. |
fieldID | The ID of the UniRec field. |
Definition at line 270 of file unirecRecord.hpp.
|
inline |
Sets the value of a UniRec array field using a vector of values.
T | The type of elements in the vector (and unirec record). |
sourceVector | The vector of values to set the field to. |
fieldID | The ID of the UniRec field. |
Definition at line 315 of file unirecRecord.hpp.
|
inlinenoexcept |
Returns the size of the UniRec record.
Definition at line 124 of file unirecRecord.hpp.
|
private |
Definition at line 392 of file unirecRecord.hpp.
|
private |
Definition at line 390 of file unirecRecord.hpp.
|
private |
Definition at line 393 of file unirecRecord.hpp.