Package org.lwjgl.nuklear
Class NkAllocator
- All Implemented Interfaces:
AutoCloseable,NativeResource,Pointer
struct nk_allocator {
nk_handle userdata;
nk_plugin_alloc alloc;
nk_plugin_free mfree;
}-
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 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
ConstructorsConstructorDescriptionNkAllocator(ByteBuffer container) Creates aNkAllocatorinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescription@Nullable NkPluginAllocalloc()alloc(@Nullable NkPluginAllocI value) Sets the specified value to theallocfield.static NkAllocatorcalloc()Returns a newNkAllocatorinstance allocated withmemCalloc.static NkAllocator.Buffercalloc(int capacity) Returns a newNkAllocator.Bufferinstance allocated withmemCalloc.static NkAllocator.Buffercalloc(int capacity, MemoryStack stack) Returns a newNkAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static NkAllocatorcalloc(MemoryStack stack) Returns a newNkAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static NkAllocatorcreate()Returns a newNkAllocatorinstance allocated withBufferUtils.static NkAllocator.Buffercreate(int capacity) Returns a newNkAllocator.Bufferinstance allocated withBufferUtils.static NkAllocatorcreate(long address) Returns a newNkAllocatorinstance for the specified memory address.static NkAllocator.Buffercreate(long address, int capacity) Create aNkAllocator.Bufferinstance at the specified memory.static @Nullable NkAllocatorcreateSafe(long address) static @Nullable NkAllocator.BuffercreateSafe(long address, int capacity) static NkAllocatormalloc()Returns a newNkAllocatorinstance allocated withmemAlloc.static NkAllocator.Buffermalloc(int capacity) Returns a newNkAllocator.Bufferinstance allocated withmemAlloc.static NkAllocator.Buffermalloc(int capacity, MemoryStack stack) Returns a newNkAllocator.Bufferinstance allocated on the specifiedMemoryStack.static NkAllocatormalloc(MemoryStack stack) Returns a newNkAllocatorinstance allocated on the specifiedMemoryStack.@Nullable NkPluginFreemfree()mfree(@Nullable NkPluginFreeI value) Sets the specified value to themfreefield.static @Nullable NkPluginAllocnalloc(long struct) Unsafe version ofalloc().static voidnalloc(long struct, @Nullable NkPluginAllocI value) Unsafe version ofalloc.static @Nullable NkPluginFreenmfree(long struct) Unsafe version ofmfree().static voidnmfree(long struct, @Nullable NkPluginFreeI value) Unsafe version ofmfree.static NkHandlenuserdata(long struct) Unsafe version ofuserdata().static voidUnsafe version ofuserdata.set(NkAllocator src) Copies the specified struct data to this struct.set(NkHandle userdata, NkPluginAllocI alloc, NkPluginFreeI mfree) Initializes this struct with the specified values.intsizeof()Returnssizeof(struct).userdata()Passes theuserdatafield to the specifiedConsumer.Copies the specifiedNkHandleto theuserdatafield.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. -
USERDATA
public static final int USERDATAThe struct member offsets. -
ALLOC
public static final int ALLOCThe struct member offsets. -
MFREE
public static final int MFREEThe struct member offsets.
-
-
Constructor Details
-
NkAllocator
Creates aNkAllocatorinstance 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<NkAllocator>
-
userdata
- Returns:
- a
NkHandleview of theuserdatafield.
-
alloc
- Returns:
- the value of the
allocfield.
-
mfree
- Returns:
- the value of the
mfreefield.
-
userdata
Copies the specifiedNkHandleto theuserdatafield. -
userdata
Passes theuserdatafield to the specifiedConsumer. -
alloc
Sets the specified value to theallocfield. -
mfree
Sets the specified value to themfreefield. -
set
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 newNkAllocatorinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newNkAllocatorinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newNkAllocatorinstance allocated withBufferUtils. -
create
Returns a newNkAllocatorinstance for the specified memory address. -
createSafe
-
malloc
Returns a newNkAllocator.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newNkAllocator.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newNkAllocator.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aNkAllocator.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newNkAllocatorinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newNkAllocatorinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newNkAllocator.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newNkAllocator.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
nuserdata
Unsafe version ofuserdata(). -
nalloc
Unsafe version ofalloc(). -
nmfree
Unsafe version ofmfree(). -
nuserdata
Unsafe version ofuserdata. -
nalloc
Unsafe version ofalloc. -
nmfree
Unsafe version ofmfree.
-