Package org.lwjgl.glfw
Class GLFWAllocator
- All Implemented Interfaces:
AutoCloseable,NativeResource,Pointer
struct GLFWallocator {
GLFWallocatefun allocate;
GLFWreallocatefun reallocate;
GLFWdeallocatefun deallocate;
void * user;
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.lwjgl.system.Struct
Struct.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.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 org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionGLFWAllocator(ByteBuffer container) Creates aGLFWAllocatorinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionallocate()allocate(GLFWAllocateCallbackI value) Sets the specified value to theallocatefield.static GLFWAllocatorcalloc()Returns a newGLFWAllocatorinstance allocated withmemCalloc.static GLFWAllocator.Buffercalloc(int capacity) Returns a newGLFWAllocator.Bufferinstance allocated withmemCalloc.static GLFWAllocator.Buffercalloc(int capacity, MemoryStack stack) Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static GLFWAllocatorcalloc(MemoryStack stack) Returns a newGLFWAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static GLFWAllocatorcreate()Returns a newGLFWAllocatorinstance allocated withBufferUtils.static GLFWAllocator.Buffercreate(int capacity) Returns a newGLFWAllocator.Bufferinstance allocated withBufferUtils.static GLFWAllocatorcreate(long address) Returns a newGLFWAllocatorinstance for the specified memory address.static GLFWAllocator.Buffercreate(long address, int capacity) Create aGLFWAllocator.Bufferinstance at the specified memory.static @Nullable GLFWAllocatorcreateSafe(long address) static @Nullable GLFWAllocator.BuffercreateSafe(long address, int capacity) Sets the specified value to thedeallocatefield.static GLFWAllocatormalloc()Returns a newGLFWAllocatorinstance allocated withmemAlloc.static GLFWAllocator.Buffermalloc(int capacity) Returns a newGLFWAllocator.Bufferinstance allocated withmemAlloc.static GLFWAllocator.Buffermalloc(int capacity, MemoryStack stack) Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStack.static GLFWAllocatormalloc(MemoryStack stack) Returns a newGLFWAllocatorinstance allocated on the specifiedMemoryStack.static GLFWAllocateCallbacknallocate(long struct) Unsafe version ofallocate().static voidnallocate(long struct, GLFWAllocateCallbackI value) Unsafe version ofallocate.static GLFWDeallocateCallbackndeallocate(long struct) Unsafe version ofdeallocate().static voidndeallocate(long struct, GLFWDeallocateCallbackI value) Unsafe version ofdeallocate.static GLFWReallocateCallbacknreallocate(long struct) Unsafe version ofreallocate().static voidnreallocate(long struct, GLFWReallocateCallbackI value) Unsafe version ofreallocate.static longnuser(long struct) Unsafe version ofuser().static voidnuser(long struct, long value) Unsafe version ofuser.Sets the specified value to thereallocatefield.set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user) Initializes this struct with the specified values.set(GLFWAllocator src) Copies the specified struct data to this struct.intsizeof()Returnssizeof(struct).longuser()user(long value) Sets the specified value to theuserfield.static voidvalidate(long struct) Validates pointer members that should not beNULL.Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface org.lwjgl.system.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. -
ALLOCATE
public static final int ALLOCATEThe struct member offsets. -
REALLOCATE
public static final int REALLOCATEThe struct member offsets. -
DEALLOCATE
public static final int DEALLOCATEThe struct member offsets. -
USER
public static final int USERThe struct member offsets.
-
-
Constructor Details
-
GLFWAllocator
Creates aGLFWAllocatorinstance 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<GLFWAllocator>
-
allocate
- Returns:
- the value of the
allocatefield.
-
reallocate
- Returns:
- the value of the
reallocatefield.
-
deallocate
- Returns:
- the value of the
deallocatefield.
-
user
public long user()- Returns:
- the value of the
userfield.
-
allocate
Sets the specified value to theallocatefield. -
reallocate
Sets the specified value to thereallocatefield. -
deallocate
Sets the specified value to thedeallocatefield. -
user
Sets the specified value to theuserfield. -
set
public GLFWAllocator set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user) 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 newGLFWAllocatorinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newGLFWAllocatorinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newGLFWAllocatorinstance allocated withBufferUtils. -
create
Returns a newGLFWAllocatorinstance for the specified memory address. -
createSafe
-
malloc
Returns a newGLFWAllocator.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newGLFWAllocator.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newGLFWAllocator.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aGLFWAllocator.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newGLFWAllocatorinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newGLFWAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
nallocate
Unsafe version ofallocate(). -
nreallocate
Unsafe version ofreallocate(). -
ndeallocate
Unsafe version ofdeallocate(). -
nuser
public static long nuser(long struct) Unsafe version ofuser(). -
nallocate
Unsafe version ofallocate. -
nreallocate
Unsafe version ofreallocate. -
ndeallocate
Unsafe version ofdeallocate. -
nuser
public static void nuser(long struct, long value) Unsafe version ofuser. -
validate
public static void validate(long struct) Validates pointer members that should not beNULL.- Parameters:
struct- the struct to validate
-