WPILibC++ 2024.3.2
DynamicStruct.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include <cassert>
10#include <memory>
11#include <span>
12#include <string>
13#include <string_view>
14#include <utility>
15#include <vector>
16
17#include "wpi/MathExtras.h"
18#include "wpi/StringMap.h"
19#include "wpi/bit.h"
20
21namespace wpi {
22
23template <typename T>
24class SmallVectorImpl;
25
26class DynamicStruct;
27class MutableDynamicStruct;
28class StructDescriptor;
29class StructDescriptorDatabase;
30
31/**
32 * Known data types for raw struct dynamic fields (see StructFieldDescriptor).
33 */
34enum class StructFieldType {
35 /// bool.
36 kBool,
37 /// char.
38 kChar,
39 /// int8.
40 kInt8,
41 /// int16.
42 kInt16,
43 /// int32.
44 kInt32,
45 /// int64.
46 kInt64,
47 /// uint8.
48 kUint8,
49 /// uint16.
50 kUint16,
51 /// uint32.
52 kUint32,
53 /// uint64.
54 kUint64,
55 /// float.
56 kFloat,
57 /// double.
58 kDouble,
59 /// struct.
60 kStruct
61};
62
63/**
64 * Raw struct dynamic field descriptor.
65 */
67 struct private_init {};
68 friend class DynamicStruct;
70 friend class StructDescriptor;
72
73 public:
74 /**
75 * Set of enumerated values.
76 */
77 using EnumValues = std::vector<std::pair<std::string, int64_t>>;
78
80 StructFieldType type, size_t size, size_t arraySize,
81 unsigned int bitWidth, EnumValues enumValues,
82 const StructDescriptor* structDesc,
83 const private_init&);
84
85 /**
86 * Gets the dynamic struct this field is contained in.
87 *
88 * @return struct descriptor
89 */
90 const StructDescriptor* GetParent() const { return m_parent; }
91
92 /**
93 * Gets the field name.
94 *
95 * @return field name
96 */
97 const std::string& GetName() const { return m_name; }
98
99 /**
100 * Gets the field type.
101 *
102 * @return field type
103 */
104 StructFieldType GetType() const { return m_type; }
105
106 /**
107 * Returns whether the field type is a signed integer.
108 *
109 * @return true if signed integer, false otherwise
110 */
111 bool IsInt() const {
112 return m_type == StructFieldType::kInt8 ||
113 m_type == StructFieldType::kInt16 ||
114 m_type == StructFieldType::kInt32 ||
115 m_type == StructFieldType::kInt64;
116 }
117
118 /**
119 * Returns whether the field type is an unsigned integer.
120 *
121 * @return true if unsigned integer, false otherwise
122 */
123 bool IsUint() const {
124 return m_type == StructFieldType::kUint8 ||
125 m_type == StructFieldType::kUint16 ||
126 m_type == StructFieldType::kUint32 ||
127 m_type == StructFieldType::kUint64;
128 }
129
130 /**
131 * Gets the underlying storage size of the field, in bytes.
132 *
133 * @return number of bytes
134 */
135 size_t GetSize() const { return m_size; }
136
137 /**
138 * Gets the storage offset of the field, in bytes.
139 *
140 * @return number of bytes from the start of the struct
141 */
142 size_t GetOffset() const { return m_offset; }
143
144 /**
145 * Gets the bit width of the field, in bits.
146 *
147 * @return number of bits
148 */
149 unsigned int GetBitWidth() const {
150 return m_bitWidth == 0 ? m_size * 8 : m_bitWidth;
151 }
152
153 /**
154 * Gets the bit mask for the field. The mask is always the least significant
155 * bits (it is not shifted).
156 *
157 * @return bit mask
158 */
159 uint64_t GetBitMask() const { return m_bitMask; }
160
161 /**
162 * Gets the bit shift for the field (LSB=0).
163 *
164 * @return number of bits
165 */
166 unsigned int GetBitShift() const { return m_bitShift; }
167
168 /**
169 * Returns whether the field is an array.
170 *
171 * @return true if array
172 */
173 bool IsArray() const { return m_arraySize > 1; }
174
175 /**
176 * Gets the array size. Returns 1 if non-array.
177 *
178 * @return number of elements
179 */
180 size_t GetArraySize() const { return m_arraySize; }
181
182 /**
183 * Returns whether the field has enumerated values.
184 *
185 * @return true if there are enumerated values
186 */
187 bool HasEnum() const { return !m_enum.empty(); }
188
189 /**
190 * Gets the enumerated values.
191 *
192 * @return set of enumerated values
193 */
194 const EnumValues& GetEnumValues() { return m_enum; }
195
196 /**
197 * Gets the struct descriptor for a struct data type.
198 *
199 * @return struct descriptor; returns null for non-struct
200 */
201 const StructDescriptor* GetStruct() const { return m_struct; }
202
203 /**
204 * Gets the minimum unsigned integer value that can be stored in this field.
205 *
206 * @return minimum value
207 */
208 uint64_t GetUintMin() const { return 0; }
209
210 /**
211 * Gets the maximum unsigned integer value that can be stored in this field.
212 *
213 * @return maximum value
214 */
215 uint64_t GetUintMax() const { return m_bitMask; }
216
217 /**
218 * Gets the minimum signed integer value that can be stored in this field.
219 *
220 * @return minimum value
221 */
222 int64_t GetIntMin() const {
223 return static_cast<int64_t>(-(m_bitMask >> 1)) - 1;
224 }
225
226 /**
227 * Gets the maximum signed integer value that can be stored in this field.
228 *
229 * @return maximum value
230 */
231 int64_t GetIntMax() const { return m_bitMask >> 1; }
232
233 /**
234 * Returns whether the field is a bitfield.
235 *
236 * @return true if bitfield
237 */
238 bool IsBitField() const {
239 return m_bitShift != 0 || m_bitWidth != (m_size * 8);
240 }
241
242 private:
243 // note: constructor fills in everything except offset and shift
244 const StructDescriptor* m_parent;
245 std::string m_name;
246 size_t m_size;
247 size_t m_offset = 0;
248 size_t m_arraySize; // 1 for non-arrays
249 EnumValues m_enum;
250 const StructDescriptor* m_struct; // nullptr for non-structs
251 uint64_t m_bitMask;
252 StructFieldType m_type;
253 unsigned int m_bitWidth;
254 unsigned int m_bitShift = 0;
255};
256
257/**
258 * Raw struct dynamic struct descriptor.
259 */
261 struct private_init {};
263
264 public:
265 StructDescriptor(std::string_view name, const private_init&) : m_name{name} {}
266
267 /**
268 * Gets the struct name.
269 *
270 * @return name
271 */
272 const std::string& GetName() const { return m_name; }
273
274 /**
275 * Gets the struct schema.
276 *
277 * @return schema
278 */
279 const std::string& GetSchema() const { return m_schema; }
280
281 /**
282 * Returns whether the struct is valid (e.g. the struct is fully defined and
283 * field offsets computed).
284 *
285 * @return true if valid
286 */
287 bool IsValid() const { return m_valid; }
288
289 /**
290 * Returns the struct size, in bytes. Not valid unless IsValid() is true.
291 *
292 * @return size in bytes
293 */
294 size_t GetSize() const {
295 assert(m_valid);
296 return m_size;
297 }
298
299 /**
300 * Gets a field descriptor by name. Note the field cannot be accessed until
301 * the struct is valid.
302 *
303 * @param name field name
304 * @return field descriptor, or nullptr if not found
305 */
307
308 /**
309 * Gets all field descriptors. Note fields cannot be accessed until the struct
310 * is valid.
311 *
312 * @return field descriptors
313 */
314 const std::vector<StructFieldDescriptor>& GetFields() const {
315 return m_fields;
316 }
317
318 private:
319 bool CheckCircular(
321 std::string CalculateOffsets(
323
324 std::string m_name;
325 std::string m_schema;
326 std::vector<StructDescriptor*> m_references;
327 std::vector<StructFieldDescriptor> m_fields;
328 StringMap<size_t> m_fieldsByName;
329 size_t m_size = 0;
330 bool m_valid = false;
331};
332
333/**
334 * Database of raw struct dynamic descriptors.
335 */
337 public:
338 /**
339 * Adds a structure schema to the database. If the struct references other
340 * structs that have not yet been added, it will not be valid until those
341 * structs are also added.
342 *
343 * @param[in] name structure name
344 * @param[in] schema structure schema
345 * @param[out] err detailed error, if nullptr is returned
346 * @return Added struct, or nullptr on error
347 */
349 std::string* err);
350
351 /**
352 * Finds a structure in the database by name.
353 *
354 * @param name structure name
355 * @return struct descriptor, or nullptr if not found
356 */
358
359 private:
361};
362
363/**
364 * Dynamic (run-time) read-only access to a serialized raw struct.
365 */
367 public:
368 /**
369 * Constructs a new dynamic struct. Note: the passed data is a span; no copy
370 * is made, so it's necessary for the lifetime of the referenced data to be
371 * longer than this object.
372 *
373 * @param desc struct descriptor
374 * @param data serialized data
375 */
376 DynamicStruct(const StructDescriptor* desc, std::span<const uint8_t> data)
377 : m_desc{desc}, m_data{data} {}
378
379 /**
380 * Gets the struct descriptor.
381 *
382 * @return struct descriptor
383 */
384 const StructDescriptor* GetDescriptor() const { return m_desc; }
385
386 /**
387 * Gets the serialized data.
388 *
389 * @return data
390 */
391 std::span<const uint8_t> GetData() const { return m_data; }
392
393 /**
394 * Gets a struct field descriptor by name.
395 *
396 * @param name field name
397 * @return field descriptor, or nullptr if no field with that name exists
398 */
400 return m_desc->FindFieldByName(name);
401 }
402
403 /**
404 * Gets the value of a boolean field.
405 *
406 * @param field field descriptor
407 * @param arrIndex array index (must be less than field array size)
408 * @return field value
409 */
411 size_t arrIndex = 0) const {
412 assert(field->m_type == StructFieldType::kBool);
413 return GetFieldImpl(field, arrIndex);
414 }
415
416 /**
417 * Gets the value of a signed integer field.
418 *
419 * @param field field descriptor
420 * @param arrIndex array index (must be less than field array size)
421 * @return field value
422 */
423 int64_t GetIntField(const StructFieldDescriptor* field,
424 size_t arrIndex = 0) const {
425 assert(field->IsInt());
426 return GetFieldImpl(field, arrIndex);
427 }
428
429 /**
430 * Gets the value of an unsigned integer field.
431 *
432 * @param field field descriptor
433 * @param arrIndex array index (must be less than field array size)
434 * @return field value
435 */
436 uint64_t GetUintField(const StructFieldDescriptor* field,
437 size_t arrIndex = 0) const {
438 assert(field->IsUint());
439 return GetFieldImpl(field, arrIndex);
440 }
441
442 /**
443 * Gets the value of a float field.
444 *
445 * @param field field descriptor
446 * @param arrIndex array index (must be less than field array size)
447 * @return field value
448 */
450 size_t arrIndex = 0) const {
451 assert(field->m_type == StructFieldType::kFloat);
452 return bit_cast<float>(
453 static_cast<uint32_t>(GetFieldImpl(field, arrIndex)));
454 }
455
456 /**
457 * Gets the value of a double field.
458 *
459 * @param field field descriptor
460 * @param arrIndex array index (must be less than field array size)
461 * @return field value
462 */
464 size_t arrIndex = 0) const {
465 assert(field->m_type == StructFieldType::kDouble);
466 return bit_cast<double>(GetFieldImpl(field, arrIndex));
467 }
468
469 /**
470 * Gets the value of a char or char array field.
471 *
472 * @param field field descriptor
473 * @return field value
474 */
476
477 /**
478 * Gets the value of a struct field.
479 *
480 * @param field field descriptor
481 * @param arrIndex array index (must be less than field array size)
482 * @return field value
483 */
485 size_t arrIndex = 0) const {
486 assert(field->m_type == StructFieldType::kStruct);
487 assert(field->m_parent == m_desc);
488 assert(m_desc->IsValid());
489 assert(arrIndex < field->m_arraySize);
490 return DynamicStruct{field->m_struct,
491 m_data.subspan(field->m_offset +
492 arrIndex * field->m_struct->GetSize())};
493 }
494
495 protected:
497
498 private:
499 uint64_t GetFieldImpl(const StructFieldDescriptor* field,
500 size_t arrIndex) const;
501
502 std::span<const uint8_t> m_data;
503};
504
505/**
506 * Dynamic (run-time) mutable access to a serialized raw struct.
507 */
509 public:
510 /**
511 * Constructs a new dynamic struct. Note: the passed data is a span; no copy
512 * is made, so it's necessary for the lifetime of the referenced data to be
513 * longer than this object.
514 *
515 * @param desc struct descriptor
516 * @param data serialized data
517 */
518 MutableDynamicStruct(const StructDescriptor* desc, std::span<uint8_t> data)
519 : DynamicStruct{desc, data}, m_data{data} {}
520
521 /**
522 * Gets the serialized data.
523 *
524 * @return data
525 */
526 std::span<uint8_t> GetData() { return m_data; }
527
529
530 /**
531 * Overwrites the entire serialized struct by copying data from a span.
532 *
533 * @param data replacement data for the struct
534 */
535 void SetData(std::span<const uint8_t> data);
536
537 /**
538 * Sets the value of a boolean field.
539 *
540 * @param field field descriptor
541 * @param value field value
542 * @param arrIndex array index (must be less than field array size)
543 */
544 void SetBoolField(const StructFieldDescriptor* field, bool value,
545 size_t arrIndex = 0) {
546 assert(field->m_type == StructFieldType::kBool);
547 SetFieldImpl(field, value ? 1 : 0, arrIndex);
548 }
549
550 /**
551 * Sets the value of a signed integer field.
552 *
553 * @param field field descriptor
554 * @param value field value
555 * @param arrIndex array index (must be less than field array size)
556 */
557 void SetIntField(const StructFieldDescriptor* field, int64_t value,
558 size_t arrIndex = 0) {
559 assert(field->IsInt());
560 SetFieldImpl(field, value, arrIndex);
561 }
562
563 /**
564 * Sets the value of an unsigned integer field.
565 *
566 * @param field field descriptor
567 * @param value field value
568 * @param arrIndex array index (must be less than field array size)
569 */
570 void SetUintField(const StructFieldDescriptor* field, uint64_t value,
571 size_t arrIndex = 0) {
572 assert(field->IsUint());
573 SetFieldImpl(field, value, arrIndex);
574 }
575
576 /**
577 * Sets the value of a float field.
578 *
579 * @param field field descriptor
580 * @param value field value
581 * @param arrIndex array index (must be less than field array size)
582 */
583 void SetFloatField(const StructFieldDescriptor* field, float value,
584 size_t arrIndex = 0) {
585 assert(field->m_type == StructFieldType::kFloat);
586 SetFieldImpl(field, bit_cast<uint32_t>(value), arrIndex);
587 }
588
589 /**
590 * Sets the value of a double field.
591 *
592 * @param field field descriptor
593 * @param value field value
594 * @param arrIndex array index (must be less than field array size)
595 */
596 void SetDoubleField(const StructFieldDescriptor* field, double value,
597 size_t arrIndex = 0) {
598 assert(field->m_type == StructFieldType::kDouble);
599 SetFieldImpl(field, bit_cast<uint64_t>(value), arrIndex);
600 }
601
602 /**
603 * Sets the value of a char or char array field.
604 *
605 * @param field field descriptor
606 * @param value field value
607 * @return true if the full value fit in the struct, false if truncated
608 */
610 std::string_view value);
611
612 /**
613 * Sets the value of a struct field.
614 *
615 * @param field field descriptor
616 * @param value field value
617 * @param arrIndex array index (must be less than field array size)
618 */
620 const DynamicStruct& value, size_t arrIndex = 0);
621
622 /**
623 * Gets the value of a struct field.
624 *
625 * @param field field descriptor
626 * @param arrIndex array index (must be less than field array size)
627 * @return field value
628 */
630 size_t arrIndex = 0) {
631 assert(field->m_type == StructFieldType::kStruct);
632 assert(field->m_parent == m_desc);
633 assert(m_desc->IsValid());
634 assert(arrIndex < field->m_arraySize);
636 field->m_struct, m_data.subspan(field->m_offset +
637 arrIndex * field->m_struct->GetSize())};
638 }
639
641
642 private:
643 void SetFieldImpl(const StructFieldDescriptor* field, uint64_t value,
644 size_t arrIndex);
645
646 std::span<uint8_t> m_data;
647};
648
649namespace impl {
650struct DSOData {
651 explicit DSOData(size_t size) : m_dataStore(size) {}
652 explicit DSOData(std::span<const uint8_t> data)
653 : m_dataStore{data.begin(), data.end()} {}
654
655 std::vector<uint8_t> m_dataStore;
656};
657} // namespace impl
658
659/**
660 * Dynamic (run-time) mutable access to a serialized raw struct, with internal
661 * data storage.
662 */
664 /**
665 * Constructs a new dynamic struct object. The descriptor must be valid.
666 *
667 * @param desc struct descriptor
668 */
669 explicit DynamicStructObject(const StructDescriptor* desc)
670 : DSOData{desc->GetSize()}, MutableDynamicStruct{desc, m_dataStore} {}
671
672 /**
673 * Constructs a new dynamic struct object. Makes a copy of the serialized
674 * data so there are no lifetime constraints on the data parameter.
675 *
676 * @param desc struct descriptor
677 * @param data serialized data
678 */
680 std::span<const uint8_t> data)
682 assert(data.size() >= desc->GetSize());
683 }
684
685 // can't be movable due to span references
687 DynamicStructObject& operator=(DynamicStructObject&&) = delete;
688};
689
690} // namespace wpi
This file defines the StringMap class.
This file implements the C++20 <bit> header.
Dynamic (run-time) read-only access to a serialized raw struct.
Definition: DynamicStruct.h:366
std::span< const uint8_t > GetData() const
Gets the serialized data.
Definition: DynamicStruct.h:391
uint64_t GetUintField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of an unsigned integer field.
Definition: DynamicStruct.h:436
const StructDescriptor * m_desc
Definition: DynamicStruct.h:496
const StructFieldDescriptor * FindField(std::string_view name) const
Gets a struct field descriptor by name.
Definition: DynamicStruct.h:399
DynamicStruct GetStructField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of a struct field.
Definition: DynamicStruct.h:484
DynamicStruct(const StructDescriptor *desc, std::span< const uint8_t > data)
Constructs a new dynamic struct.
Definition: DynamicStruct.h:376
double GetDoubleField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of a double field.
Definition: DynamicStruct.h:463
const StructDescriptor * GetDescriptor() const
Gets the struct descriptor.
Definition: DynamicStruct.h:384
int64_t GetIntField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of a signed integer field.
Definition: DynamicStruct.h:423
bool GetBoolField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of a boolean field.
Definition: DynamicStruct.h:410
std::string_view GetStringField(const StructFieldDescriptor *field) const
Gets the value of a char or char array field.
float GetFloatField(const StructFieldDescriptor *field, size_t arrIndex=0) const
Gets the value of a float field.
Definition: DynamicStruct.h:449
Dynamic (run-time) mutable access to a serialized raw struct, with internal data storage.
Definition: DynamicStruct.h:663
Dynamic (run-time) mutable access to a serialized raw struct.
Definition: DynamicStruct.h:508
void SetFloatField(const StructFieldDescriptor *field, float value, size_t arrIndex=0)
Sets the value of a float field.
Definition: DynamicStruct.h:583
void SetBoolField(const StructFieldDescriptor *field, bool value, size_t arrIndex=0)
Sets the value of a boolean field.
Definition: DynamicStruct.h:544
MutableDynamicStruct GetStructField(const StructFieldDescriptor *field, size_t arrIndex=0)
Gets the value of a struct field.
Definition: DynamicStruct.h:629
void SetUintField(const StructFieldDescriptor *field, uint64_t value, size_t arrIndex=0)
Sets the value of an unsigned integer field.
Definition: DynamicStruct.h:570
MutableDynamicStruct(const StructDescriptor *desc, std::span< uint8_t > data)
Constructs a new dynamic struct.
Definition: DynamicStruct.h:518
std::span< uint8_t > GetData()
Gets the serialized data.
Definition: DynamicStruct.h:526
bool SetStringField(const StructFieldDescriptor *field, std::string_view value)
Sets the value of a char or char array field.
void SetDoubleField(const StructFieldDescriptor *field, double value, size_t arrIndex=0)
Sets the value of a double field.
Definition: DynamicStruct.h:596
void SetData(std::span< const uint8_t > data)
Overwrites the entire serialized struct by copying data from a span.
void SetStructField(const StructFieldDescriptor *field, const DynamicStruct &value, size_t arrIndex=0)
Sets the value of a struct field.
void SetIntField(const StructFieldDescriptor *field, int64_t value, size_t arrIndex=0)
Sets the value of a signed integer field.
Definition: DynamicStruct.h:557
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:579
Database of raw struct dynamic descriptors.
Definition: DynamicStruct.h:336
const StructDescriptor * Find(std::string_view name) const
Finds a structure in the database by name.
const StructDescriptor * Add(std::string_view name, std::string_view schema, std::string *err)
Adds a structure schema to the database.
Raw struct dynamic struct descriptor.
Definition: DynamicStruct.h:260
const StructFieldDescriptor * FindFieldByName(std::string_view name) const
Gets a field descriptor by name.
StructDescriptor(std::string_view name, const private_init &)
Definition: DynamicStruct.h:265
const std::vector< StructFieldDescriptor > & GetFields() const
Gets all field descriptors.
Definition: DynamicStruct.h:314
size_t GetSize() const
Returns the struct size, in bytes.
Definition: DynamicStruct.h:294
bool IsValid() const
Returns whether the struct is valid (e.g.
Definition: DynamicStruct.h:287
const std::string & GetSchema() const
Gets the struct schema.
Definition: DynamicStruct.h:279
const std::string & GetName() const
Gets the struct name.
Definition: DynamicStruct.h:272
Raw struct dynamic field descriptor.
Definition: DynamicStruct.h:66
const StructDescriptor * GetStruct() const
Gets the struct descriptor for a struct data type.
Definition: DynamicStruct.h:201
size_t GetOffset() const
Gets the storage offset of the field, in bytes.
Definition: DynamicStruct.h:142
StructFieldType GetType() const
Gets the field type.
Definition: DynamicStruct.h:104
const StructDescriptor * GetParent() const
Gets the dynamic struct this field is contained in.
Definition: DynamicStruct.h:90
int64_t GetIntMax() const
Gets the maximum signed integer value that can be stored in this field.
Definition: DynamicStruct.h:231
const std::string & GetName() const
Gets the field name.
Definition: DynamicStruct.h:97
const EnumValues & GetEnumValues()
Gets the enumerated values.
Definition: DynamicStruct.h:194
std::vector< std::pair< std::string, int64_t > > EnumValues
Set of enumerated values.
Definition: DynamicStruct.h:77
uint64_t GetUintMin() const
Gets the minimum unsigned integer value that can be stored in this field.
Definition: DynamicStruct.h:208
unsigned int GetBitShift() const
Gets the bit shift for the field (LSB=0).
Definition: DynamicStruct.h:166
size_t GetSize() const
Gets the underlying storage size of the field, in bytes.
Definition: DynamicStruct.h:135
bool IsUint() const
Returns whether the field type is an unsigned integer.
Definition: DynamicStruct.h:123
bool IsArray() const
Returns whether the field is an array.
Definition: DynamicStruct.h:173
int64_t GetIntMin() const
Gets the minimum signed integer value that can be stored in this field.
Definition: DynamicStruct.h:222
bool HasEnum() const
Returns whether the field has enumerated values.
Definition: DynamicStruct.h:187
StructFieldDescriptor(const StructDescriptor *parent, std::string_view name, StructFieldType type, size_t size, size_t arraySize, unsigned int bitWidth, EnumValues enumValues, const StructDescriptor *structDesc, const private_init &)
unsigned int GetBitWidth() const
Gets the bit width of the field, in bits.
Definition: DynamicStruct.h:149
uint64_t GetBitMask() const
Gets the bit mask for the field.
Definition: DynamicStruct.h:159
uint64_t GetUintMax() const
Gets the maximum unsigned integer value that can be stored in this field.
Definition: DynamicStruct.h:215
size_t GetArraySize() const
Gets the array size.
Definition: DynamicStruct.h:180
bool IsInt() const
Returns whether the field type is a signed integer.
Definition: DynamicStruct.h:111
bool IsBitField() const
Returns whether the field is a bitfield.
Definition: DynamicStruct.h:238
basic_string_view< char > string_view
Definition: core.h:501
type
Definition: core.h:556
constexpr const char * name(const T &)
Definition: ntcore_cpp.h:26
Definition: DynamicStruct.h:650
DSOData(std::span< const uint8_t > data)
Definition: DynamicStruct.h:652
std::vector< uint8_t > m_dataStore
Definition: DynamicStruct.h:655
DSOData(size_t size)
Definition: DynamicStruct.h:651
StructFieldType
Known data types for raw struct dynamic fields (see StructFieldDescriptor).
Definition: DynamicStruct.h:34