Struct TVMFFIFieldInfo#

Struct Documentation#

struct TVMFFIFieldInfo#

Information support for optional object reflection.

Public Members

TVMFFIByteArray name#

The name of the field.

TVMFFIByteArray doc#

The docstring about the field.

TVMFFIByteArray metadata#

The structured metadata of the field in JSON string.

int64_t flags#

bitmask flags of the field.

int64_t size#

The size of the field.

int64_t alignment#

The alignment of the field.

int64_t offset#

The offset of the field.

TVMFFIFieldGetter getter#

The getter to access the field.

TVMFFIFieldSetter setter#

The setter to access the field.

Note

The setter is set even if the field is readonly for serialization.

TVMFFIAny default_value#

The default value of the field, this field hold AnyView, valid when flags set kTVMFFIFieldFlagBitMaskHasDefault.

int32_t field_static_type_index#

Records the static type kind of the field.

Possible values:

  • TVMFFITypeIndex::kTVMFFIObject for general objects. The value is nullable when kTVMFFIObject is chosen.

  • Static object type kinds such as Map, Dict, String

  • POD type index, note it does not give information about storage size of the field.

  • TVMFFITypeIndex::kTVMFFIAny if we don’t have specialized info about the field.

When the value is a type index of Object type, the field is storaged as an ObjectRef.

Note

This information maybe helpful in designing serializer. As it helps to narrow down the field type so we don’t have to print type_key for cases like POD types. It also helps to provide opportunities to enable short-cut getter to ObjectRef fields.