@Name(value="tvm::runtime::InplaceArrayBase<tvm::runtime::ADTObj,tvm::runtime::ObjectRef>") @Properties(inherit=tvm_runtime.class) public class ADTObjBase extends Pointer
// Example usage of the template to define a simple array wrapper
class ArrayObj : public InplaceArrayBase<ArrayObj, Elem> {
public:
// Wrap EmplaceInit to initialize the elements
template <typename Iterator>
void Init(Iterator begin, Iterator end) {
size_t num_elems = std::distance(begin, end);
auto it = begin;
this->size = 0;
for (size_t i = 0; i < num_elems; ++i) {
InplaceArrayBase::EmplaceInit(i, *it++);
this->size++;
}
}
}
void test_function() {
vector<Elem> fields;
auto ptr = make_inplace_array_object<ArrayObj, Elem>(fields.size());
ptr->Init(fields.begin(), fields.end());
// Access the 0th element in the array.
assert(ptr->operator[](0) == fields[0]);
}
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Constructor and Description |
|---|
ADTObjBase()
Default native constructor.
|
ADTObjBase(long size)
Native array allocator.
|
ADTObjBase(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ObjectRef |
get(long idx)
\brief Access element at index
|
ADTObjBase |
getPointer(long i) |
ADTObjBase |
position(long position) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zeropublic ADTObjBase()
public ADTObjBase(long size)
Pointer.position(long).public ADTObjBase(Pointer p)
Pointer(Pointer).public ADTObjBase position(long position)
public ADTObjBase getPointer(long i)
getPointer in class PointerCopyright © 2022. All rights reserved.