Package org.lwjgl.glfw
Class GLFWAllocator
- All Implemented Interfaces:
AutoCloseable
,NativeResource
,Pointer
struct GLFWallocator {
{@link GLFWAllocateCallbackI GLFWallocatefun} allocate;
{@link GLFWReallocateCallbackI GLFWreallocatefun} reallocate;
{@link GLFWDeallocateCallbackI GLFWdeallocatefun} deallocate;
void * user;
}
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.lwjgl.system.Struct
Struct.StructValidation
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The struct alignment in bytes.static final int
The struct member offsets.static final int
The struct member offsets.static final int
The struct member offsets.static final int
The struct size in bytes.static final int
The 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 aGLFWAllocator
instance at the current position of the specifiedByteBuffer
container. -
Method Summary
Modifier and TypeMethodDescriptionallocate()
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, MemoryStack stack) Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static GLFWAllocator
calloc
(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 @Nullable GLFWAllocator
createSafe
(long address) static @Nullable GLFWAllocator.Buffer
createSafe
(long address, int capacity) 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, MemoryStack stack) Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
.static GLFWAllocator
malloc
(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
.Sets the specified value to thereallocate
field.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.int
sizeof()
Returnssizeof(struct)
.long
user()
user
(long value) Sets the specified value to theuser
field.static void
validate
(long struct) Validates pointer members that should not beNULL
.Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
Methods 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 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 Details
-
sizeof
public int sizeof()Description copied from class:Struct
Returnssizeof(struct)
.- Specified by:
sizeof
in classStruct<GLFWAllocator>
-
allocate
- Returns:
- the value of the
allocate
field.
-
reallocate
- Returns:
- the value of the
reallocate
field.
-
deallocate
- Returns:
- the value of the
deallocate
field.
-
user
public long user()- Returns:
- the value of the
user
field.
-
allocate
Sets the specified value to theallocate
field. -
reallocate
Sets the specified value to thereallocate
field. -
deallocate
Sets the specified value to thedeallocate
field. -
user
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
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
Returns a newGLFWAllocator
instance allocated withmemAlloc
. The instance must be explicitly freed. -
calloc
Returns a newGLFWAllocator
instance allocated withmemCalloc
. The instance must be explicitly freed. -
create
Returns a newGLFWAllocator
instance allocated withBufferUtils
. -
create
Returns a newGLFWAllocator
instance for the specified memory address. -
createSafe
-
malloc
Returns a newGLFWAllocator.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
Returns a newGLFWAllocator.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
Returns a newGLFWAllocator.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
Create aGLFWAllocator.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
-
malloc
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
calloc
Returns a newGLFWAllocator
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
malloc
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
capacity
- the buffer capacitystack
- the stack from which to allocate
-
calloc
Returns a newGLFWAllocator.Buffer
instance allocated on the specifiedMemoryStack
and 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
-