Struct TVMFFIFieldInfo#
Defined in File c_api.h
Inheritance Relationships#
Derived Type#
public tvm::ffi::reflection::FieldInfoBuilder(Struct FieldInfoBuilder)
Struct Documentation#
-
struct TVMFFIFieldInfo#
Information support for optional object reflection.
Subclassed by tvm::ffi::reflection::FieldInfoBuilder
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_or_factory#
The default value or default factory of the field.
When flags has kTVMFFIFieldFlagBitMaskHasDefault set:
If kTVMFFIFieldFlagBitMaskDefaultFromFactory is NOT set, this holds the static default value as AnyView.
If kTVMFFIFieldFlagBitMaskDefaultFromFactory IS set, this holds a Function (() -> Any) that produces the default.
-
int32_t field_static_type_index#
The compile-time static type index of the field.
This reflects the type declared at compile time, which is only trustworthy for statically-inferrable types. It does NOT necessarily match the runtime type. For example, a field declared as
Anywill havefield_static_type_index == kTVMFFIAnyeven if it holds anintat runtime, andArray<Any>will reportkTVMFFIArrayeven though the elements may beArray<int>at runtime.Note
This is used by the serializer to inline POD field values directly (avoiding node-graph overhead for None, Bool, Int, Float, DataType), while routing other types through the node graph.
Warning
Do NOT use this field to determine the actual type of a value at runtime. It is purely a compile-time hint derived from the C++ field declaration. The actual runtime type must be obtained from the value’s own
type_index.Warning
When the static type is a generic container (e.g.
Array<Any>), this field only tells you it is an Array — it says nothing about the element types actually stored inside. Similarly,kTVMFFIObjectonly means “some ObjectRef” without any subtype information.
-
TVMFFIByteArray name#