Package org.lwjgl.system.libffi
Class FFIType
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.system.libffi.FFIType
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,org.lwjgl.system.NativeResource
,org.lwjgl.system.Pointer
public class FFIType extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResource
Contains information about a libffi type.Layout
struct ffi_type { size_t
size()
; unsigned shortalignment()
; unsigned shorttype()
; ffi_type *elements(int)
; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FFIType.Buffer
An array ofFFIType
structs.
-
Constructor Summary
Constructors Constructor Description FFIType(java.nio.ByteBuffer container)
Creates aFFIType
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description short
alignment()
set by libffi; you should initialize it to zero.FFIType
alignment(short value)
Sets the specified value to thealignment()
field.static FFIType
calloc()
Returns a newFFIType
instance allocated withmemCalloc
.static FFIType.Buffer
calloc(int capacity)
Returns a newFFIType.Buffer
instance allocated withmemCalloc
.static FFIType.Buffer
calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static FFIType
calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIType
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static FFIType
create()
Returns a newFFIType
instance allocated withBufferUtils
.static FFIType.Buffer
create(int capacity)
Returns a newFFIType.Buffer
instance allocated withBufferUtils
.static FFIType
create(long address)
Returns a newFFIType
instance for the specified memory address.static FFIType.Buffer
create(long address, int capacity)
Create aFFIType.Buffer
instance at the specified memory.static FFIType
createSafe(long address)
static FFIType.Buffer
createSafe(long address, int capacity)
org.lwjgl.PointerBuffer
elements(int capacity)
FFIType
elements(org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to theelements(int)
field.static FFIType
malloc()
Returns a newFFIType
instance allocated withmemAlloc
.static FFIType.Buffer
malloc(int capacity)
Returns a newFFIType.Buffer
instance allocated withmemAlloc
.static FFIType.Buffer
malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
.static FFIType
malloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIType
instance allocated on the specifiedMemoryStack
.static short
nalignment(long struct)
Unsafe version ofalignment()
.static void
nalignment(long struct, short value)
Unsafe version ofalignment
.static org.lwjgl.PointerBuffer
nelements(long struct, int capacity)
Unsafe version ofelements
.static void
nelements(long struct, org.lwjgl.PointerBuffer value)
Unsafe version ofelements
.static long
nsize(long struct)
Unsafe version ofsize()
.static void
nsize(long struct, long value)
Unsafe version ofsize
.static short
ntype(long struct)
Unsafe version oftype()
.static void
ntype(long struct, short value)
Unsafe version oftype
.FFIType
set(long size, short alignment, short type, org.lwjgl.PointerBuffer elements)
Initializes this struct with the specified values.FFIType
set(FFIType src)
Copies the specified struct data to this struct.long
size()
set by libffi; you should initialize it to zero.FFIType
size(long value)
Sets the specified value to thesize()
field.int
sizeof()
short
type()
for a structure, this should be set toTYPE_STRUCT
.FFIType
type(short value)
Sets the specified value to thetype()
field.
-
-
-
Constructor Detail
-
FFIType
public FFIType(java.nio.ByteBuffer container)
Creates aFFIType
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
-
size, alignment
public long size() public short alignment()
set by libffi; you should initialize it to zero.
-
type
public short type()
for a structure, this should be set toTYPE_STRUCT
.
-
elements
@Nullable public org.lwjgl.PointerBuffer elements(int capacity)
- Parameters:
capacity
- the number of elements in the returned buffer- Returns:
- a null-terminated array of pointers to
ffi_type
objects. There is one element per field of the struct.
-
alignment
public FFIType alignment(short value)
Sets the specified value to thealignment()
field.
-
elements
public FFIType elements(@Nullable org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to theelements(int)
field.
-
set
public FFIType set(long size, short alignment, short type, @Nullable org.lwjgl.PointerBuffer elements)
Initializes this struct with the specified values.
-
set
public FFIType set(FFIType src)
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
public static FFIType malloc()
Returns a newFFIType
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static FFIType calloc()
Returns a newFFIType
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static FFIType create()
Returns a newFFIType
instance allocated withBufferUtils
.
-
create
public static FFIType create(long address)
Returns a newFFIType
instance for the specified memory address.
-
createSafe
@Nullable public static FFIType createSafe(long address)
-
malloc
public static FFIType.Buffer malloc(int capacity)
Returns a newFFIType.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static FFIType.Buffer calloc(int capacity)
Returns a newFFIType.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static FFIType.Buffer create(int capacity)
Returns a newFFIType.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static FFIType.Buffer create(long address, int capacity)
Create aFFIType.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
@Nullable public static FFIType.Buffer createSafe(long address, int capacity)
-
malloc
public static FFIType malloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIType
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
calloc
public static FFIType calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFIType
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
malloc
public static FFIType.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
calloc
public static FFIType.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
nsize
public static long nsize(long struct)
Unsafe version ofsize()
.
-
nalignment
public static short nalignment(long struct)
Unsafe version ofalignment()
.
-
ntype
public static short ntype(long struct)
Unsafe version oftype()
.
-
nelements
@Nullable public static org.lwjgl.PointerBuffer nelements(long struct, int capacity)
Unsafe version ofelements
.
-
nsize
public static void nsize(long struct, long value)
Unsafe version ofsize
.
-
nalignment
public static void nalignment(long struct, short value)
Unsafe version ofalignment
.
-
ntype
public static void ntype(long struct, short value)
Unsafe version oftype
.
-
nelements
public static void nelements(long struct, @Nullable org.lwjgl.PointerBuffer value)
Unsafe version ofelements
.
-
-