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.NativeResourceA custom memory allocator that can be set withInitAllocator.Layout
struct GLFWallocator {GLFWallocatefunallocate();GLFWreallocatefunreallocate();GLFWdeallocatefundeallocate(); void *user(); }- Since:
- version 3.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGLFWAllocator.BufferAn array ofGLFWAllocatorstructs.
-
Field Summary
Fields Modifier and Type Field Description static intALIGNOFThe struct alignment in bytes.static intALLOCATE
DEALLOCATE
REALLOCATEThe struct member offsets.static intSIZEOFThe struct size in bytes.static intUSERThe struct member offsets.
-
Constructor Summary
Constructors Constructor Description GLFWAllocator(java.nio.ByteBuffer container)Creates aGLFWAllocatorinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GLFWAllocateCallbackallocate()the memory allocation callbackGLFWAllocatorallocate(GLFWAllocateCallbackI value)Sets the specified value to theallocate()field.static GLFWAllocatorcalloc()Returns a newGLFWAllocatorinstance allocated withmemCalloc.static GLFWAllocator.Buffercalloc(int capacity)Returns a newGLFWAllocator.Bufferinstance allocated withmemCalloc.static GLFWAllocator.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static GLFWAllocatorcalloc(org.lwjgl.system.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 GLFWAllocatorcreateSafe(long address)static GLFWAllocator.BuffercreateSafe(long address, int capacity)GLFWDeallocateCallbackdeallocate()the memory deallocation callbackGLFWAllocatordeallocate(GLFWDeallocateCallbackI value)Sets the specified value to thedeallocate()field.static GLFWAllocatormalloc()Returns a newGLFWAllocatorinstance allocated withmemAlloc.static GLFWAllocator.Buffermalloc(int capacity)Returns a newGLFWAllocator.Bufferinstance allocated withmemAlloc.static GLFWAllocator.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newGLFWAllocator.Bufferinstance allocated on the specifiedMemoryStack.static GLFWAllocatormalloc(org.lwjgl.system.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.GLFWReallocateCallbackreallocate()the memory reallocation callbackGLFWAllocatorreallocate(GLFWReallocateCallbackI value)Sets the specified value to thereallocate()field.GLFWAllocatorset(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user)Initializes this struct with the specified values.GLFWAllocatorset(GLFWAllocator src)Copies the specified struct data to this struct.intsizeof()longuser()a user-defined pointer that will be passed to the callbacksGLFWAllocatoruser(long value)Sets the specified value to theuser()field.static voidvalidate(long struct)Validates pointer members that should not beNULL.
-
-
-
Constructor Detail
-
GLFWAllocator
public GLFWAllocator(java.nio.ByteBuffer container)
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 Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin 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 newGLFWAllocatorinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static GLFWAllocator calloc()
Returns a newGLFWAllocatorinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static GLFWAllocator create()
Returns a newGLFWAllocatorinstance allocated withBufferUtils.
-
create
public static GLFWAllocator create(long address)
Returns a newGLFWAllocatorinstance for the specified memory address.
-
createSafe
@Nullable public static GLFWAllocator createSafe(long address)
-
malloc
public static GLFWAllocator.Buffer malloc(int capacity)
Returns a newGLFWAllocator.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static GLFWAllocator.Buffer calloc(int capacity)
Returns a newGLFWAllocator.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static GLFWAllocator.Buffer create(int capacity)
Returns a newGLFWAllocator.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static GLFWAllocator.Buffer create(long address, int capacity)
Create aGLFWAllocator.Bufferinstance 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 newGLFWAllocatorinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static GLFWAllocator calloc(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWAllocatorinstance allocated on the specifiedMemoryStackand 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.Bufferinstance 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.Bufferinstance allocated on the specifiedMemoryStackand 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
-
-