Dynamic (run-time) read-only access to a serialized raw struct.
More...
#include <wpi/struct/DynamicStruct.h>
Dynamic (run-time) read-only access to a serialized raw struct.
◆ DynamicStruct()
wpi::DynamicStruct::DynamicStruct |
( |
const StructDescriptor * | desc, |
|
|
std::span< const uint8_t > | data ) |
|
inline |
Constructs a new dynamic struct.
Note: the passed data is a span; no copy is made, so it's necessary for the lifetime of the referenced data to be longer than this object.
- Parameters
-
desc | struct descriptor |
data | serialized data |
◆ FindField()
Gets a struct field descriptor by name.
- Parameters
-
- Returns
- field descriptor, or nullptr if no field with that name exists
◆ GetBoolField()
Gets the value of a boolean field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ GetData()
std::span< const uint8_t > wpi::DynamicStruct::GetData |
( |
| ) |
const |
|
inline |
Gets the serialized data.
- Returns
- data
◆ GetDescriptor()
Gets the struct descriptor.
- Returns
- struct descriptor
◆ GetDoubleField()
double wpi::DynamicStruct::GetDoubleField |
( |
const StructFieldDescriptor * | field, |
|
|
size_t | arrIndex = 0 ) const |
|
inline |
Gets the value of a double field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ GetFloatField()
float wpi::DynamicStruct::GetFloatField |
( |
const StructFieldDescriptor * | field, |
|
|
size_t | arrIndex = 0 ) const |
|
inline |
Gets the value of a float field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ GetIntField()
int64_t wpi::DynamicStruct::GetIntField |
( |
const StructFieldDescriptor * | field, |
|
|
size_t | arrIndex = 0 ) const |
|
inline |
Gets the value of a signed integer field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ GetStringField()
Gets the value of a char or char array field.
- Parameters
-
- Returns
- field value
◆ GetStructField()
Gets the value of a struct field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ GetUintField()
uint64_t wpi::DynamicStruct::GetUintField |
( |
const StructFieldDescriptor * | field, |
|
|
size_t | arrIndex = 0 ) const |
|
inline |
Gets the value of an unsigned integer field.
- Parameters
-
field | field descriptor |
arrIndex | array index (must be less than field array size) |
- Returns
- field value
◆ m_desc
The documentation for this class was generated from the following file: