Class EnumObj#
Defined in File enum.h
Inheritance Relationships#
Base Type#
public tvm::ffi::Object(Class Object)
Class Documentation#
-
class EnumObj : public tvm::ffi::Object#
Base class for FFI-registered enums.
Each registered variant is a unique, process-wide singleton with a dense ordinal (
_value) and string_name. Subclasses may add declared fields — part of the variant’s schema, set at registration time viareflection::EnumDef. Separately, any consumer may attach extensible attributes (per-variant metadata stored outside the variant’s fields) viaEnumDef::set_attror the PythonEnum.def_attrsurface, without modifyingEnumClsObj.See also
Public Functions
-
EnumObj() = default#
Public Members
-
int64_t _value#
Declared field: dense ordinal assigned at registration time (0-indexed per class).
Public Static Functions
-
template<typename EnumClsObj>
static inline Enum Get(const String &name)# Look up the registered singleton for
EnumClsObjby name.Reads from the per-class
reflection::type_attr::kEnumEntriesregistry populated byreflection::EnumDef<EnumClsObj>. Instances are unique per(type_key, name)pair for the life of the process, so the returnedEnumcompares equal (by pointer) to every other lookup of the same name. ThrowsRuntimeErrorif no instance with the given name is registered forEnumClsObj.
-
EnumObj() = default#