Class ExrAllocator
- All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer
struct ExrAllocator {
void * userdata;
void * (* alloc) (void * userdata, size_t size, size_t alignment);
void * (* realloc) (void * userdata, void * ptr, size_t old_size, size_t new_size, size_t alignment);
void (* free) (void * userdata, void * ptr, size_t size);
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Struct
Struct.StructValidationNested classes/interfaces inherited from interface Pointer
Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct alignment in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct size in bytes.static final intThe struct member offsets.Fields inherited from interface Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionExrAllocator(ByteBuffer container) Creates aExrAllocatorinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionalloc()Sets the specified value to theallocfield.static ExrAllocatorcalloc()Returns a newExrAllocatorinstance allocated withmemCalloc.static ExrAllocator.Buffercalloc(int capacity) Returns a newExrAllocator.Bufferinstance allocated withmemCalloc.static ExrAllocator.Buffercalloc(int capacity, MemoryStack stack) Returns a newExrAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static ExrAllocatorcalloc(MemoryStack stack) Returns a newExrAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static ExrAllocatorcreate()Returns a newExrAllocatorinstance allocated withBufferUtils.static ExrAllocator.Buffercreate(int capacity) Returns a newExrAllocator.Bufferinstance allocated withBufferUtils.static ExrAllocatorcreate(long address) Returns a newExrAllocatorinstance for the specified memory address.static ExrAllocator.Buffercreate(long address, int capacity) Create aExrAllocator.Bufferinstance at the specified memory.static @Nullable ExrAllocatorcreateSafe(long address) static @Nullable ExrAllocator.BuffercreateSafe(long address, int capacity) free$()Sets the specified value to thefreefield.static ExrAllocatormalloc()Returns a newExrAllocatorinstance allocated withmemAlloc.static ExrAllocator.Buffermalloc(int capacity) Returns a newExrAllocator.Bufferinstance allocated withmemAlloc.static ExrAllocator.Buffermalloc(int capacity, MemoryStack stack) Returns a newExrAllocator.Bufferinstance allocated on the specifiedMemoryStack.static ExrAllocatormalloc(MemoryStack stack) Returns a newExrAllocatorinstance allocated on the specifiedMemoryStack.static ExrAllocnalloc(long struct) Unsafe version ofalloc().static voidUnsafe version ofalloc.static ExrFreenfree$(long struct) Unsafe version offree$().static voidUnsafe version offree$.static ExrReallocnrealloc(long struct) Unsafe version ofrealloc().static voidnrealloc(long struct, ExrReallocI value) Unsafe version ofrealloc.static longnuserdata(long struct) Unsafe version ofuserdata().static voidnuserdata(long struct, long value) Unsafe version ofuserdata.realloc()realloc(ExrReallocI value) Sets the specified value to thereallocfield.set(long userdata, ExrAllocI alloc, ExrReallocI realloc, ExrFreeI free$) Initializes this struct with the specified values.set(ExrAllocator src) Copies the specified struct data to this struct.intsizeof()Returnssizeof(struct).longuserdata()userdata(long value) Sets the specified value to theuserdatafield.static voidvalidate(long struct) Validates pointer members that should not beNULL.Methods inherited from class Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface NativeResource
close, free
-
Field Details
-
SIZEOF
public static final int SIZEOFThe struct size in bytes. -
ALIGNOF
public static final int ALIGNOFThe struct alignment in bytes. -
USERDATA
public static final int USERDATAThe struct member offsets. -
ALLOC
public static final int ALLOCThe struct member offsets. -
REALLOC
public static final int REALLOCThe struct member offsets. -
FREE
public static final int FREEThe struct member offsets.
-
-
Constructor Details
-
ExrAllocator
Creates aExrAllocatorinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Details
-
sizeof
public int sizeof()Description copied from class:StructReturnssizeof(struct).- Specified by:
sizeofin classStruct<ExrAllocator>
-
userdata
- Returns:
- the value of the
userdatafield.
-
alloc
- Returns:
- the value of the
allocfield.
-
realloc
- Returns:
- the value of the
reallocfield.
-
free$
- Returns:
- the value of the
freefield.
-
userdata
Sets the specified value to theuserdatafield. -
alloc
Sets the specified value to theallocfield. -
realloc
public ExrAllocator realloc(@NativeType("void * (*) (void *, void *, size_t, size_t, size_t)") ExrReallocI value) Sets the specified value to thereallocfield. -
free$
Sets the specified value to thefreefield. -
set
Initializes this struct with the specified values. -
set
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
Returns a newExrAllocatorinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newExrAllocatorinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newExrAllocatorinstance allocated withBufferUtils. -
create
Returns a newExrAllocatorinstance for the specified memory address. -
createSafe
-
malloc
Returns a newExrAllocator.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newExrAllocator.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newExrAllocator.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aExrAllocator.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newExrAllocatorinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newExrAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newExrAllocator.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newExrAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
nuserdata
public static long nuserdata(long struct) Unsafe version ofuserdata(). -
nalloc
-
nrealloc
Unsafe version ofrealloc(). -
nfree$
-
nuserdata
public static void nuserdata(long struct, long value) Unsafe version ofuserdata. -
nalloc
-
nrealloc
Unsafe version ofrealloc. -
nfree$
-
validate
public static void validate(long struct) Validates pointer members that should not beNULL.- Parameters:
struct- the struct to validate
-