Package org.lwjgl.glfw
Class GLFWAllocator
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.glfw.GLFWAllocator
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,org.lwjgl.system.NativeResource
,org.lwjgl.system.Pointer
public class GLFWAllocator extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResource
A custom memory allocator that can be set withInitAllocator
.Layout
struct GLFWallocator {
GLFWallocatefun
allocate()
;GLFWreallocatefun
reallocate()
;GLFWdeallocatefun
deallocate()
; void *user()
; }- Since:
- version 3.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GLFWAllocator.Buffer
An array ofGLFWAllocator
structs.
-
Field Summary
Fields Modifier and Type Field Description static int
ALIGNOF
The struct alignment in bytes.static int
ALLOCATE
DEALLOCATE
REALLOCATEThe struct member offsets.static int
SIZEOF
The struct size in bytes.static int
USER
The struct member offsets.
-
Constructor Summary
Constructors Constructor Description GLFWAllocator(java.nio.ByteBuffer container)
Creates aGLFWAllocator
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GLFWAllocateCallback
allocate()
the memory allocation callbackGLFWAllocator
allocate(GLFWAllocateCallbackI value)
Sets the specified value to theallocate()
field.static GLFWAllocator
calloc()
Returns a newGLFWAllocator
instance allocated withmemCalloc
.static GLFWAllocator.Buffer
calloc(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withmemCalloc
.static GLFWAllocator.Buffer
calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static GLFWAllocator
calloc(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static GLFWAllocator
create()
Returns a newGLFWAllocator
instance allocated withBufferUtils
.static GLFWAllocator.Buffer
create(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withBufferUtils
.static GLFWAllocator
create(long address)
Returns a newGLFWAllocator
instance for the specified memory address.static GLFWAllocator.Buffer
create(long address, int capacity)
Create aGLFWAllocator.Buffer
instance at the specified memory.static GLFWAllocator
createSafe(long address)
static GLFWAllocator.Buffer
createSafe(long address, int capacity)
GLFWDeallocateCallback
deallocate()
the memory deallocation callbackGLFWAllocator
deallocate(GLFWDeallocateCallbackI value)
Sets the specified value to thedeallocate()
field.static GLFWAllocator
malloc()
Returns a newGLFWAllocator
instance allocated withmemAlloc
.static GLFWAllocator.Buffer
malloc(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withmemAlloc
.static GLFWAllocator.Buffer
malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
.static GLFWAllocator
malloc(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
.static GLFWAllocateCallback
nallocate(long struct)
Unsafe version ofallocate()
.static void
nallocate(long struct, GLFWAllocateCallbackI value)
Unsafe version ofallocate
.static GLFWDeallocateCallback
ndeallocate(long struct)
Unsafe version ofdeallocate()
.static void
ndeallocate(long struct, GLFWDeallocateCallbackI value)
Unsafe version ofdeallocate
.static GLFWReallocateCallback
nreallocate(long struct)
Unsafe version ofreallocate()
.static void
nreallocate(long struct, GLFWReallocateCallbackI value)
Unsafe version ofreallocate
.static long
nuser(long struct)
Unsafe version ofuser()
.static void
nuser(long struct, long value)
Unsafe version ofuser
.GLFWReallocateCallback
reallocate()
the memory reallocation callbackGLFWAllocator
reallocate(GLFWReallocateCallbackI value)
Sets the specified value to thereallocate()
field.GLFWAllocator
set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user)
Initializes this struct with the specified values.GLFWAllocator
set(GLFWAllocator src)
Copies the specified struct data to this struct.int
sizeof()
long
user()
a user-defined pointer that will be passed to the callbacksGLFWAllocator
user(long value)
Sets the specified value to theuser()
field.static void
validate(long struct)
Validates pointer members that should not beNULL
.
-
-
-
Constructor Detail
-
GLFWAllocator
public GLFWAllocator(java.nio.ByteBuffer container)
Creates aGLFWAllocator
instance at the current position of the specifiedByteBuffer
container. 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 Detail
-
sizeof
public int sizeof()
- Specified by:
sizeof
in classorg.lwjgl.system.Struct
-
allocate
public GLFWAllocateCallback allocate()
the memory allocation callback
-
reallocate
public GLFWReallocateCallback reallocate()
the memory reallocation callback
-
deallocate
public GLFWDeallocateCallback deallocate()
the memory deallocation callback
-
user
public long user()
a user-defined pointer that will be passed to the callbacks
-
allocate
public GLFWAllocator allocate(GLFWAllocateCallbackI value)
Sets the specified value to theallocate()
field.
-
reallocate
public GLFWAllocator reallocate(GLFWReallocateCallbackI value)
Sets the specified value to thereallocate()
field.
-
deallocate
public GLFWAllocator deallocate(GLFWDeallocateCallbackI value)
Sets the specified value to thedeallocate()
field.
-
user
public GLFWAllocator user(long value)
Sets the specified value to theuser()
field.
-
set
public GLFWAllocator set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user)
Initializes this struct with the specified values.
-
set
public GLFWAllocator set(GLFWAllocator src)
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
public static GLFWAllocator malloc()
Returns a newGLFWAllocator
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static GLFWAllocator calloc()
Returns a newGLFWAllocator
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static GLFWAllocator create()
Returns a newGLFWAllocator
instance allocated withBufferUtils
.
-
create
public static GLFWAllocator create(long address)
Returns a newGLFWAllocator
instance for the specified memory address.
-
createSafe
@Nullable public static GLFWAllocator createSafe(long address)
-
malloc
public static GLFWAllocator.Buffer malloc(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static GLFWAllocator.Buffer calloc(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static GLFWAllocator.Buffer create(int capacity)
Returns a newGLFWAllocator.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static GLFWAllocator.Buffer create(long address, int capacity)
Create aGLFWAllocator.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
@Nullable public static GLFWAllocator.Buffer createSafe(long address, int capacity)
-
malloc
public static GLFWAllocator malloc(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
calloc
public static GLFWAllocator calloc(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
malloc
public static GLFWAllocator.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
calloc
public static GLFWAllocator.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
nallocate
public static GLFWAllocateCallback nallocate(long struct)
Unsafe version ofallocate()
.
-
nreallocate
public static GLFWReallocateCallback nreallocate(long struct)
Unsafe version ofreallocate()
.
-
ndeallocate
public static GLFWDeallocateCallback ndeallocate(long struct)
Unsafe version ofdeallocate()
.
-
nuser
public static long nuser(long struct)
Unsafe version ofuser()
.
-
nallocate
public static void nallocate(long struct, GLFWAllocateCallbackI value)
Unsafe version ofallocate
.
-
nreallocate
public static void nreallocate(long struct, GLFWReallocateCallbackI value)
Unsafe version ofreallocate
.
-
ndeallocate
public static void ndeallocate(long struct, GLFWDeallocateCallbackI value)
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
-
-