Top Description Inners Fields Constructors Methods
org.lwjgl.glfw

public Class GLFWAllocator

extends Struct<GLFWAllocator>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable
Annotations
@NativeType:struct GLFWallocator
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

A custom memory allocator that can be set with InitAllocator.

Layout


struct GLFWallocator {
    GLFWallocatefun allocate;
    GLFWreallocatefun reallocate;
    GLFWdeallocatefun deallocate;
    void * user;
}
Since
version 3.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
GLFWAllocator.Buffer

An array of GLFWAllocator structs.

Field Summary

Modifier and TypeField and Description
public static final int
ALIGNOF

The struct alignment in bytes.

public static final int
ALLOCATE

The struct member offsets.

public static final int
DEALLOCATE

The struct member offsets.

public static final int
REALLOCATE

The struct member offsets.

public static final int
SIZEOF

The struct size in bytes.

public static final int
USER

The struct member offsets.

Inherited from org.lwjgl.system.Struct:
containerDEFAULT_ALIGN_ASDEFAULT_PACK_ALIGNMENT

Constructor Summary

AccessConstructor and Description
protected
GLFWAllocator(long address, ByteBuffer container)

public
GLFWAllocator(ByteBuffer container)

Creates a GLFWAllocator instance at the current position of the specified ByteBuffer container.

Method Summary

Modifier and TypeMethod and Description
public GLFWAllocateCallback
allocate()

the memory allocation callback

public GLFWAllocator
allocate(GLFWAllocateCallbackI value)

Sets the specified value to the allocate field.

public static GLFWAllocator
calloc()

Returns a new GLFWAllocator instance allocated with memCalloc.

public static GLFWAllocator.Buffer
calloc(int
the buffer capacity
capacity
)

Returns a new GLFWAllocator.Buffer instance allocated with memCalloc.

public static GLFWAllocator
calloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new GLFWAllocator instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static GLFWAllocator.Buffer
calloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new GLFWAllocator.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

protected GLFWAllocator
create(long
the struct memory address
address
,
ByteBuffer
an optional container buffer, to be referenced strongly by the struct instance.
container
)

Implements abstract org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.
public static GLFWAllocator
create()

Returns a new GLFWAllocator instance allocated with BufferUtils.

public static GLFWAllocator
create(long address)

Returns a new GLFWAllocator instance for the specified memory address.

public static GLFWAllocator.Buffer
create(int
the buffer capacity
capacity
)

Returns a new GLFWAllocator.Buffer instance allocated with BufferUtils.

public static GLFWAllocator.Buffer
create(long
the memory address
address
,
int
the buffer capacity
capacity
)

Create a GLFWAllocator.Buffer instance at the specified memory.

public static GLFWAllocator
createSafe(long address)

Like create, but returns null if address is NULL.

public static GLFWAllocator.Buffer
createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

public GLFWDeallocateCallback
deallocate()

the memory deallocation callback

public GLFWAllocator
deallocate(GLFWDeallocateCallbackI value)

Sets the specified value to the deallocate field.

public static GLFWAllocator
malloc()

Returns a new GLFWAllocator instance allocated with memAlloc.

public static GLFWAllocator.Buffer
malloc(int
the buffer capacity
capacity
)

Returns a new GLFWAllocator.Buffer instance allocated with memAlloc.

public static GLFWAllocator
malloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new GLFWAllocator instance allocated on the specified MemoryStack.

public static GLFWAllocator.Buffer
malloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new GLFWAllocator.Buffer instance allocated on the specified MemoryStack.

public static GLFWAllocateCallback
nallocate(long struct)

Unsafe version of allocate.

public static void
nallocate(long struct, GLFWAllocateCallbackI value)

Unsafe version of allocate.

public static GLFWDeallocateCallback
ndeallocate(long struct)

Unsafe version of deallocate.

public static void
ndeallocate(long struct, GLFWDeallocateCallbackI value)

Unsafe version of deallocate.

public static GLFWReallocateCallback
nreallocate(long struct)

Unsafe version of reallocate.

public static void
nreallocate(long struct, GLFWReallocateCallbackI value)

Unsafe version of reallocate.

public static long
nuser(long struct)

Unsafe version of user.

public static void
nuser(long struct, long value)

Unsafe version of user.

public GLFWReallocateCallback
reallocate()

the memory reallocation callback

public GLFWAllocator
reallocate(GLFWReallocateCallbackI value)

Sets the specified value to the reallocate field.

public GLFWAllocator
set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user)

Initializes this struct with the specified values.

public GLFWAllocator

Returns:

this struct
set
(GLFWAllocator
the source struct
src
)

Copies the specified struct data to this struct.

public int
sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).
public long
user()

a user-defined pointer that will be passed to the callbacks

public GLFWAllocator
user(long value)

Sets the specified value to the user field.

public static void
validate(long
the struct to validate
struct
)

Validates pointer members that should not be NULL.

Inherited from org.lwjgl.system.Struct:
__array__array__array__checkContainer__checkMalloc__create__getContainer__getContainer__member__member__member__padding__padding__struct__struct__union__unionclearfreeisNullvalidate

Field Detail

ALIGNOFback to summary
public static final int ALIGNOF

The struct alignment in bytes.

ALLOCATEback to summary
public static final int ALLOCATE

The struct member offsets.

DEALLOCATEback to summary
public static final int DEALLOCATE

The struct member offsets.

REALLOCATEback to summary
public static final int REALLOCATE

The struct member offsets.

SIZEOFback to summary
public static final int SIZEOF

The struct size in bytes.

USERback to summary
public static final int USER

The struct member offsets.

Constructor Detail

GLFWAllocatorback to summary
protected GLFWAllocator(long address, ByteBuffer container)
GLFWAllocatorback to summary
public GLFWAllocator(ByteBuffer container)

Creates a GLFWAllocator instance at the current position of the specified ByteBuffer 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

allocateback to summary
public GLFWAllocateCallback allocate()

the memory allocation callback

Annotations
@NativeType:GLFWallocatefun
allocateback to summary
public GLFWAllocator allocate(GLFWAllocateCallbackI value)

Sets the specified value to the allocate field.

callocback to summary
public static GLFWAllocator calloc()

Returns a new GLFWAllocator instance allocated with memCalloc. The instance must be explicitly freed.

callocback to summary
public static GLFWAllocator.Buffer calloc(int capacity)

Returns a new GLFWAllocator.Buffer instance allocated with memCalloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

callocback to summary
public static GLFWAllocator calloc(MemoryStack stack)

Returns a new GLFWAllocator instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
stack:MemoryStack

the stack from which to allocate

callocback to summary
public static GLFWAllocator.Buffer calloc(int capacity, MemoryStack stack)

Returns a new GLFWAllocator.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

createback to summary
protected GLFWAllocator create(long address, ByteBuffer container)

Implements abstract org.lwjgl.system.Struct.create.

Doc from org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.

Effectively, every Struct instance is a factory for more instances of the same type. This is used by StructBuffer.

Parameters
address:long

the struct memory address

container:ByteBuffer

an optional container buffer, to be referenced strongly by the struct instance.

Annotations
@Override
createback to summary
public static GLFWAllocator create()

Returns a new GLFWAllocator instance allocated with BufferUtils.

createback to summary
public static GLFWAllocator create(long address)

Returns a new GLFWAllocator instance for the specified memory address.

createback to summary
public static GLFWAllocator.Buffer create(int capacity)

Returns a new GLFWAllocator.Buffer instance allocated with BufferUtils.

Parameters
capacity:int

the buffer capacity

createback to summary
public static GLFWAllocator.Buffer create(long address, int capacity)

Create a GLFWAllocator.Buffer instance at the specified memory.

Parameters
address:long

the memory address

capacity:int

the buffer capacity

createSafeback to summary
public static GLFWAllocator createSafe(long address)

Like create, but returns null if address is NULL.

Annotations
@Nullable
createSafeback to summary
public static GLFWAllocator.Buffer createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

Annotations
@Nullable
deallocateback to summary
public GLFWDeallocateCallback deallocate()

the memory deallocation callback

Annotations
@NativeType:GLFWdeallocatefun
deallocateback to summary
public GLFWAllocator deallocate(GLFWDeallocateCallbackI value)

Sets the specified value to the deallocate field.

mallocback to summary
public static GLFWAllocator malloc()

Returns a new GLFWAllocator instance allocated with memAlloc. The instance must be explicitly freed.

mallocback to summary
public static GLFWAllocator.Buffer malloc(int capacity)

Returns a new GLFWAllocator.Buffer instance allocated with memAlloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

mallocback to summary
public static GLFWAllocator malloc(MemoryStack stack)

Returns a new GLFWAllocator instance allocated on the specified MemoryStack.

Parameters
stack:MemoryStack

the stack from which to allocate

mallocback to summary
public static GLFWAllocator.Buffer malloc(int capacity, MemoryStack stack)

Returns a new GLFWAllocator.Buffer instance allocated on the specified MemoryStack.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

nallocateback to summary
public static GLFWAllocateCallback nallocate(long struct)

Unsafe version of allocate.

nallocateback to summary
public static void nallocate(long struct, GLFWAllocateCallbackI value)

Unsafe version of allocate.

ndeallocateback to summary
public static GLFWDeallocateCallback ndeallocate(long struct)

Unsafe version of deallocate.

ndeallocateback to summary
public static void ndeallocate(long struct, GLFWDeallocateCallbackI value)

Unsafe version of deallocate.

nreallocateback to summary
public static GLFWReallocateCallback nreallocate(long struct)

Unsafe version of reallocate.

nreallocateback to summary
public static void nreallocate(long struct, GLFWReallocateCallbackI value)

Unsafe version of reallocate.

nuserback to summary
public static long nuser(long struct)

Unsafe version of user.

nuserback to summary
public static void nuser(long struct, long value)

Unsafe version of user.

reallocateback to summary
public GLFWReallocateCallback reallocate()

the memory reallocation callback

Annotations
@NativeType:GLFWreallocatefun
reallocateback to summary
public GLFWAllocator reallocate(GLFWReallocateCallbackI value)

Sets the specified value to the reallocate field.

setback to summary
public GLFWAllocator set(GLFWAllocateCallbackI allocate, GLFWReallocateCallbackI reallocate, GLFWDeallocateCallbackI deallocate, long user)

Initializes this struct with the specified values.

setback to summary
public GLFWAllocator set(GLFWAllocator src)

Copies the specified struct data to this struct.

Parameters
src:GLFWAllocator

the source struct

Returns:GLFWAllocator

this struct

sizeofback to summary
public int sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Doc from org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).

Annotations
@Override
userback to summary
public long user()

a user-defined pointer that will be passed to the callbacks

Annotations
@NativeType:void *
userback to summary
public GLFWAllocator user(long value)

Sets the specified value to the user field.

validateback to summary
public static void validate(long struct)

Validates pointer members that should not be NULL.

Parameters
struct:long

the struct to validate

org.lwjgl.glfw back to summary

public Class GLFWAllocator.Buffer

extends StructBuffer<GLFWAllocator, GLFWAllocator.Buffer>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable

An array of GLFWAllocator structs.

Field Summary

Modifier and TypeField and Description
private static final GLFWAllocator

Constructor Summary

AccessConstructor and Description
public
Buffer(ByteBuffer container)

Creates a new GLFWAllocator.Buffer instance backed by the specified container.

public
Buffer(long address, int cap)

pack-priv
Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Summary

Modifier and TypeMethod and Description
public GLFWAllocateCallback

Returns:

the value of the GLFWAllocator#allocate field.
allocate
()

public GLFWAllocator.Buffer
allocate(GLFWAllocateCallbackI value)

Sets the specified value to the GLFWAllocator#allocate field.

public GLFWDeallocateCallback

Returns:

the value of the GLFWAllocator#deallocate field.
deallocate
()

public GLFWAllocator.Buffer
deallocate(GLFWDeallocateCallbackI value)

Sets the specified value to the GLFWAllocator#deallocate field.

protected GLFWAllocator
public GLFWReallocateCallback

Returns:

the value of the GLFWAllocator#reallocate field.
reallocate
()

public GLFWAllocator.Buffer
reallocate(GLFWReallocateCallbackI value)

Sets the specified value to the GLFWAllocator#reallocate field.

protected GLFWAllocator.Buffer
public long

Returns:

the value of the GLFWAllocator#user field.
user
()

public GLFWAllocator.Buffer
user(long value)

Sets the specified value to the GLFWAllocator#user field.

Inherited from org.lwjgl.system.StructBuffer:
applyapplyforEachgetgetgetgetiteratorparallelStreamputputsizeofspliteratorstream

Field Detail

ELEMENT_FACTORYback to summary
private static final GLFWAllocator ELEMENT_FACTORY

Constructor Detail

Bufferback to summary
public Buffer(ByteBuffer container)

Creates a new GLFWAllocator.Buffer instance backed by the specified container.

Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by GLFWAllocator#SIZEOF, and its mark will be undefined.

The created buffer instance holds a strong reference to the container object.

Bufferback to summary
public Buffer(long address, int cap)
Bufferback to summary
pack-priv Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Detail

allocateback to summary
public GLFWAllocateCallback allocate()
Returns:GLFWAllocateCallback

the value of the GLFWAllocator#allocate field.

Annotations
@NativeType:GLFWallocatefun
allocateback to summary
public GLFWAllocator.Buffer allocate(GLFWAllocateCallbackI value)

Sets the specified value to the GLFWAllocator#allocate field.

deallocateback to summary
public GLFWDeallocateCallback deallocate()
Returns:GLFWDeallocateCallback

the value of the GLFWAllocator#deallocate field.

Annotations
@NativeType:GLFWdeallocatefun
deallocateback to summary
public GLFWAllocator.Buffer deallocate(GLFWDeallocateCallbackI value)

Sets the specified value to the GLFWAllocator#deallocate field.

getElementFactoryback to summary
protected GLFWAllocator getElementFactory()

Implements abstract org.lwjgl.system.StructBuffer.getElementFactory.

Annotations
@Override
reallocateback to summary
public GLFWReallocateCallback reallocate()
Returns:GLFWReallocateCallback

the value of the GLFWAllocator#reallocate field.

Annotations
@NativeType:GLFWreallocatefun
reallocateback to summary
public GLFWAllocator.Buffer reallocate(GLFWReallocateCallbackI value)

Sets the specified value to the GLFWAllocator#reallocate field.

selfback to summary
protected GLFWAllocator.Buffer self()

Implements abstract org.lwjgl.system.CustomBuffer.self.

Annotations
@Override
userback to summary
public long user()
Returns:long

the value of the GLFWAllocator#user field.

Annotations
@NativeType:void *
userback to summary
public GLFWAllocator.Buffer user(long value)

Sets the specified value to the GLFWAllocator#user field.