MIP_SDK  v3.0.0-187-g93c7302
MicroStrain Communications Library for embedded systems
Classes | Functions
mip::metadata::utils Namespace Reference

Classes

struct  ParamEnum
 
struct  ParamEnum< Type::BOOL >
 
struct  ParamEnum< Type::CHAR >
 
struct  ParamEnum< Type::DOUBLE >
 
struct  ParamEnum< Type::FLOAT >
 
struct  ParamEnum< Type::S16 >
 
struct  ParamEnum< Type::S32 >
 
struct  ParamEnum< Type::S64 >
 
struct  ParamEnum< Type::S8 >
 
struct  ParamEnum< Type::U16 >
 
struct  ParamEnum< Type::U32 >
 
struct  ParamEnum< Type::U64 >
 
struct  ParamEnum< Type::U8 >
 
struct  ParamType
 
struct  ParamType< Bitfield< T >, void >
 
struct  ParamType< bool, void >
 
struct  ParamType< char, void >
 
struct  ParamType< double, void >
 
struct  ParamType< float, void >
 
struct  ParamType< int16_t, void >
 
struct  ParamType< int32_t, void >
 
struct  ParamType< int64_t, void >
 
struct  ParamType< int8_t, void >
 
struct  ParamType< T, typename EnableForFieldTypes< T >::type >
 
struct  ParamType< T, typename std::enable_if< std::is_enum< T >::value, T >::type >
 
struct  ParamType< T, typename std::enable_if< std::is_union< T >::value, T >::type >
 
struct  ParamType< uint16_t, void >
 
struct  ParamType< uint32_t, void >
 
struct  ParamType< uint64_t, void >
 
struct  ParamType< uint8_t, void >
 

Functions

template<class Field , class T , auto Ptr>
void * access (void *p)
 
Type serializedType (const TypeInfo &type)
 Determines the type used for serialization purposes. More...
 
constexpr size_t serializedSizeForBasicType (Type type, const void *info=nullptr)
 Gets the size of a basic type (including bitfields and enums if class_ is not NULL). More...
 
constexpr size_t serializedSizeForBasicType (const TypeInfo &type)
 
constexpr const char * nameForBasicType (Type type)
 
constexpr const char * nameOfType (const TypeInfo &type)
 
constexpr size_t sizeForBasicType (const Type type, const void *info=nullptr)
 Gets the size of a basic type (including bitfields and enums if info is not NULL). More...
 
constexpr size_t sizeForBasicType (const TypeInfo &type)
 
constexpr size_t alignmentForBasicType (const Type type, const void *info=nullptr)
 Gets the size of a basic type (including bitfields and enums if info is not NULL). More...
 
constexpr size_t alignmentForBasicType (const TypeInfo &type)
 
const ParameterInfogetParameterInfoFromStructMemberOffset (const size_t offset, const FieldInfo &field_info)
 Get a pointer to a parameter given the offset of the member in the class/struct. More...
 

Function Documentation

◆ access()

template<class Field , class T , auto Ptr>
void* mip::metadata::utils::access ( void *  p)

◆ alignmentForBasicType() [1/2]

constexpr size_t mip::metadata::utils::alignmentForBasicType ( const Type  type,
const void *  info = nullptr 
)
constexpr

Gets the size of a basic type (including bitfields and enums if info is not NULL).

◆ alignmentForBasicType() [2/2]

constexpr size_t mip::metadata::utils::alignmentForBasicType ( const TypeInfo type)
constexpr

◆ getParameterInfoFromStructMemberOffset()

const ParameterInfo* mip::metadata::utils::getParameterInfoFromStructMemberOffset ( const size_t  offset,
const FieldInfo field_info 
)
inline

Get a pointer to a parameter given the offset of the member in the class/struct.

Warning
This does not work for nested types, I.E. ClassType.member1.member2
See also
GET_MIP_METADATA_PARAM_INFO
Parameters
offsetThe offset of the member within the struct/class. Use the C++ offsetof or a variant to get this value
field_infoMetadata field info to look up parameter info for
Returns
A pointer to the parameter info if found, otherwise nullptr

◆ nameForBasicType()

constexpr const char* mip::metadata::utils::nameForBasicType ( Type  type)
constexpr

◆ nameOfType()

constexpr const char* mip::metadata::utils::nameOfType ( const TypeInfo type)
constexpr

◆ serializedSizeForBasicType() [1/2]

constexpr size_t mip::metadata::utils::serializedSizeForBasicType ( const TypeInfo type)
constexpr

◆ serializedSizeForBasicType() [2/2]

constexpr size_t mip::metadata::utils::serializedSizeForBasicType ( Type  type,
const void *  info = nullptr 
)
constexpr

Gets the size of a basic type (including bitfields and enums if class_ is not NULL).

◆ serializedType()

Type mip::metadata::utils::serializedType ( const TypeInfo type)
inline

Determines the type used for serialization purposes.

This essentially translates bitfields and enums to their underlying types.

Returns
A basic type, such as u8, s32, float, etc. if possible.
Type::NONE if type is NONE or if it's a compound type like a struct or union.

◆ sizeForBasicType() [1/2]

constexpr size_t mip::metadata::utils::sizeForBasicType ( const Type  type,
const void *  info = nullptr 
)
constexpr

Gets the size of a basic type (including bitfields and enums if info is not NULL).

◆ sizeForBasicType() [2/2]

constexpr size_t mip::metadata::utils::sizeForBasicType ( const TypeInfo type)
constexpr