@Name(value="tvm::runtime::Object") @NoOffset @Properties(inherit=tvm_runtime.class) public class TVMObject extends Pointer
make_object,
ObjectPtr,
{@code
// Create a base object
class BaseObj : public Object {
public:
// object fields
int field0;
// object properties
static constexpr const uint32_t _type_index = TypeIndex::kDynamic;
static constexpr const char* _type_key = "test.BaseObj";
TVM_DECLARE_BASE_OBJECT_INFO(BaseObj, Object);
};
class ObjLeaf : public ObjBase {
public:
// fields
int child_field0;
// object properties
static constexpr const uint32_t _type_index = TypeIndex::kDynamic;
static constexpr const char* _type_key = "test.LeafObj";
TVM_DECLARE_BASE_OBJECT_INFO(LeafObj, Object);
};
// The following code should be put into a cc file.
TVM_REGISTER_OBJECT_TYPE(ObjBase);
TVM_REGISTER_OBJECT_TYPE(ObjLeaf);
// Usage example.
void TestObjects() {
// create an object
ObjectRef leaf_ref(make_object());
// cast to a specific instance
const LeafObj* leaf_ptr = leaf_ref.as();
CHECK(leaf_ptr != nullptr);
// can also cast to the base class.
CHECK(leaf_ref.as() != nullptr);
}
} | Modifier and Type | Class and Description |
|---|---|
static class |
TVMObject.FDeleter
\brief Object deleter
|
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Modifier and Type | Field and Description |
|---|---|
static int |
_type_child_slots |
static boolean |
_type_child_slots_can_overflow |
static boolean |
_type_final |
static boolean |
_type_has_method_sequal_reduce |
static boolean |
_type_has_method_shash_reduce |
static boolean |
_type_has_method_visit_attrs |
static int |
_type_index |
| Constructor and Description |
|---|
TVMObject() |
TVMObject(long size)
Native array allocator.
|
TVMObject(Pointer p)
Pointer cast constructor.
|
TVMObject(TVMObject other) |
| Modifier and Type | Method and Description |
|---|---|
static int |
_GetOrAllocRuntimeTypeIndex() |
static boolean |
_type_child_slots_can_overflow() |
static int |
_type_child_slots() |
static boolean |
_type_final() |
static boolean |
_type_has_method_sequal_reduce() |
static boolean |
_type_has_method_shash_reduce() |
static boolean |
_type_has_method_visit_attrs() |
static int |
_type_index() |
static BytePointer |
_type_key() |
TVMObject |
getPointer(long i) |
BytePointer |
GetTypeKey() |
long |
GetTypeKeyHash() |
TVMObject |
position(long position) |
TVMObject |
put(TVMObject other) |
static int |
RuntimeTypeIndex() |
int |
type_index() |
static BytePointer |
TypeIndex2Key(int tindex)
\brief Get the type key of the corresponding index from runtime.
|
static long |
TypeIndex2KeyHash(int tindex)
\brief Get the type key hash of the corresponding index from runtime.
|
static int |
TypeKey2Index(BytePointer key)
\brief Get the type index of the corresponding key from runtime.
|
static int |
TypeKey2Index(String key) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getPointer, getPointer, getPointer, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zeropublic static final boolean _type_final
public static final int _type_child_slots
public static final boolean _type_child_slots_can_overflow
public static final boolean _type_has_method_visit_attrs
public static final boolean _type_has_method_sequal_reduce
public static final boolean _type_has_method_shash_reduce
public static final int _type_index
public TVMObject(Pointer p)
Pointer(Pointer).public TVMObject(long size)
Pointer.position(long).public TVMObject()
public TVMObject getPointer(long i)
getPointer in class Pointer@Cast(value="uint32_t") public int type_index()
@StdString public BytePointer GetTypeKey()
@Cast(value="size_t") public long GetTypeKeyHash()
@StdString public static BytePointer TypeIndex2Key(@Cast(value="uint32_t") int tindex)
tindex - The type index.@Cast(value="size_t") public static long TypeIndex2KeyHash(@Cast(value="uint32_t") int tindex)
tindex - The type index.@Cast(value="uint32_t") public static int TypeKey2Index(@StdString BytePointer key)
key - The type key.@Cast(value="uint32_t") public static int TypeKey2Index(@StdString String key)
@MemberGetter @Cast(value="const char*") public static BytePointer _type_key()
@MemberGetter @Cast(value="const bool") public static boolean _type_final()
@MemberGetter @Cast(value="const uint32_t") public static int _type_child_slots()
@MemberGetter @Cast(value="const bool") public static boolean _type_child_slots_can_overflow()
@MemberGetter @Cast(value="const bool") public static boolean _type_has_method_visit_attrs()
@MemberGetter @Cast(value="const bool") public static boolean _type_has_method_sequal_reduce()
@MemberGetter @Cast(value="const bool") public static boolean _type_has_method_shash_reduce()
@MemberGetter @Cast(value="const uint32_t") public static int _type_index()
Copyright © 2021. All rights reserved.