WPILibC++ 2024.1.1-beta-4
wpi::StructDescriptor Class Reference

Raw struct dynamic struct descriptor. More...

#include <wpi/struct/DynamicStruct.h>

Public Member Functions

 StructDescriptor (std::string_view name, const private_init &)
 
const std::string & GetName () const
 Gets the struct name. More...
 
const std::string & GetSchema () const
 Gets the struct schema. More...
 
bool IsValid () const
 Returns whether the struct is valid (e.g. More...
 
size_t GetSize () const
 Returns the struct size, in bytes. More...
 
const StructFieldDescriptorFindFieldByName (std::string_view name) const
 Gets a field descriptor by name. More...
 
const std::vector< StructFieldDescriptor > & GetFields () const
 Gets all field descriptors. More...
 

Friends

class StructDescriptorDatabase
 

Detailed Description

Raw struct dynamic struct descriptor.

Constructor & Destructor Documentation

◆ StructDescriptor()

wpi::StructDescriptor::StructDescriptor ( std::string_view  name,
const private_init &   
)
inline

Member Function Documentation

◆ FindFieldByName()

const StructFieldDescriptor * wpi::StructDescriptor::FindFieldByName ( std::string_view  name) const

Gets a field descriptor by name.

Note the field cannot be accessed until the struct is valid.

Parameters
namefield name
Returns
field descriptor, or nullptr if not found

◆ GetFields()

const std::vector< StructFieldDescriptor > & wpi::StructDescriptor::GetFields ( ) const
inline

Gets all field descriptors.

Note fields cannot be accessed until the struct is valid.

Returns
field descriptors

◆ GetName()

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

Gets the struct name.

Returns
name

◆ GetSchema()

const std::string & wpi::StructDescriptor::GetSchema ( ) const
inline

Gets the struct schema.

Returns
schema

◆ GetSize()

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

Returns the struct size, in bytes.

Not valid unless IsValid() is true.

Returns
size in bytes

◆ IsValid()

bool wpi::StructDescriptor::IsValid ( ) const
inline

Returns whether the struct is valid (e.g.

the struct is fully defined and field offsets computed).

Returns
true if valid

Friends And Related Function Documentation

◆ StructDescriptorDatabase

friend class StructDescriptorDatabase
friend

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