WPILibC++ 2024.3.2
wpi::StructFieldDescriptor Class Reference

Raw struct dynamic field descriptor. More...

#include <wpi/struct/DynamicStruct.h>

Public Types

using EnumValues = std::vector< std::pair< std::string, int64_t > >
 Set of enumerated values. More...
 

Public Member Functions

 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 &)
 
const StructDescriptorGetParent () const
 Gets the dynamic struct this field is contained in. More...
 
const std::string & GetName () const
 Gets the field name. More...
 
StructFieldType GetType () const
 Gets the field type. More...
 
bool IsInt () const
 Returns whether the field type is a signed integer. More...
 
bool IsUint () const
 Returns whether the field type is an unsigned integer. More...
 
size_t GetSize () const
 Gets the underlying storage size of the field, in bytes. More...
 
size_t GetOffset () const
 Gets the storage offset of the field, in bytes. More...
 
unsigned int GetBitWidth () const
 Gets the bit width of the field, in bits. More...
 
uint64_t GetBitMask () const
 Gets the bit mask for the field. More...
 
unsigned int GetBitShift () const
 Gets the bit shift for the field (LSB=0). More...
 
bool IsArray () const
 Returns whether the field is an array. More...
 
size_t GetArraySize () const
 Gets the array size. More...
 
bool HasEnum () const
 Returns whether the field has enumerated values. More...
 
const EnumValuesGetEnumValues ()
 Gets the enumerated values. More...
 
const StructDescriptorGetStruct () const
 Gets the struct descriptor for a struct data type. More...
 
uint64_t GetUintMin () const
 Gets the minimum unsigned integer value that can be stored in this field. More...
 
uint64_t GetUintMax () const
 Gets the maximum unsigned integer value that can be stored in this field. More...
 
int64_t GetIntMin () const
 Gets the minimum signed integer value that can be stored in this field. More...
 
int64_t GetIntMax () const
 Gets the maximum signed integer value that can be stored in this field. More...
 
bool IsBitField () const
 Returns whether the field is a bitfield. More...
 

Friends

class DynamicStruct
 
class MutableDynamicStruct
 
class StructDescriptor
 
class StructDescriptorDatabase
 

Detailed Description

Raw struct dynamic field descriptor.

Member Typedef Documentation

◆ EnumValues

using wpi::StructFieldDescriptor::EnumValues = std::vector<std::pair<std::string, int64_t> >

Set of enumerated values.

Constructor & Destructor Documentation

◆ StructFieldDescriptor()

wpi::StructFieldDescriptor::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 &   
)

Member Function Documentation

◆ GetArraySize()

size_t wpi::StructFieldDescriptor::GetArraySize ( ) const
inline

Gets the array size.

Returns 1 if non-array.

Returns
number of elements

◆ GetBitMask()

uint64_t wpi::StructFieldDescriptor::GetBitMask ( ) const
inline

Gets the bit mask for the field.

The mask is always the least significant bits (it is not shifted).

Returns
bit mask

◆ GetBitShift()

unsigned int wpi::StructFieldDescriptor::GetBitShift ( ) const
inline

Gets the bit shift for the field (LSB=0).

Returns
number of bits

◆ GetBitWidth()

unsigned int wpi::StructFieldDescriptor::GetBitWidth ( ) const
inline

Gets the bit width of the field, in bits.

Returns
number of bits

◆ GetEnumValues()

const EnumValues & wpi::StructFieldDescriptor::GetEnumValues ( )
inline

Gets the enumerated values.

Returns
set of enumerated values

◆ GetIntMax()

int64_t wpi::StructFieldDescriptor::GetIntMax ( ) const
inline

Gets the maximum signed integer value that can be stored in this field.

Returns
maximum value

◆ GetIntMin()

int64_t wpi::StructFieldDescriptor::GetIntMin ( ) const
inline

Gets the minimum signed integer value that can be stored in this field.

Returns
minimum value

◆ GetName()

const std::string & wpi::StructFieldDescriptor::GetName ( ) const
inline

Gets the field name.

Returns
field name

◆ GetOffset()

size_t wpi::StructFieldDescriptor::GetOffset ( ) const
inline

Gets the storage offset of the field, in bytes.

Returns
number of bytes from the start of the struct

◆ GetParent()

const StructDescriptor * wpi::StructFieldDescriptor::GetParent ( ) const
inline

Gets the dynamic struct this field is contained in.

Returns
struct descriptor

◆ GetSize()

size_t wpi::StructFieldDescriptor::GetSize ( ) const
inline

Gets the underlying storage size of the field, in bytes.

Returns
number of bytes

◆ GetStruct()

const StructDescriptor * wpi::StructFieldDescriptor::GetStruct ( ) const
inline

Gets the struct descriptor for a struct data type.

Returns
struct descriptor; returns null for non-struct

◆ GetType()

StructFieldType wpi::StructFieldDescriptor::GetType ( ) const
inline

Gets the field type.

Returns
field type

◆ GetUintMax()

uint64_t wpi::StructFieldDescriptor::GetUintMax ( ) const
inline

Gets the maximum unsigned integer value that can be stored in this field.

Returns
maximum value

◆ GetUintMin()

uint64_t wpi::StructFieldDescriptor::GetUintMin ( ) const
inline

Gets the minimum unsigned integer value that can be stored in this field.

Returns
minimum value

◆ HasEnum()

bool wpi::StructFieldDescriptor::HasEnum ( ) const
inline

Returns whether the field has enumerated values.

Returns
true if there are enumerated values

◆ IsArray()

bool wpi::StructFieldDescriptor::IsArray ( ) const
inline

Returns whether the field is an array.

Returns
true if array

◆ IsBitField()

bool wpi::StructFieldDescriptor::IsBitField ( ) const
inline

Returns whether the field is a bitfield.

Returns
true if bitfield

◆ IsInt()

bool wpi::StructFieldDescriptor::IsInt ( ) const
inline

Returns whether the field type is a signed integer.

Returns
true if signed integer, false otherwise

◆ IsUint()

bool wpi::StructFieldDescriptor::IsUint ( ) const
inline

Returns whether the field type is an unsigned integer.

Returns
true if unsigned integer, false otherwise

Friends And Related Function Documentation

◆ DynamicStruct

friend class DynamicStruct
friend

◆ MutableDynamicStruct

friend class MutableDynamicStruct
friend

◆ StructDescriptor

friend class StructDescriptor
friend

◆ StructDescriptorDatabase

friend class StructDescriptorDatabase
friend

The documentation for this class was generated from the following file: