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:
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 short alignment()
;
unsigned short type()
;
ffi_type * elements(int)
;
}
-
Nested Class Summary
Nested classes/interfaces inherited from class org.lwjgl.system.Struct
org.lwjgl.system.Struct.StructValidation
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
org.lwjgl.system.Pointer.Default
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The struct member offsets.static 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 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
ConstructorDescriptionFFIType
(ByteBuffer container) Creates aFFIType
instance at the current position of the specifiedByteBuffer
container. -
Method Summary
Modifier and TypeMethodDescriptionshort
set by libffi; you should initialize it to zero.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) 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
.set
(long size, short alignment, short type, org.lwjgl.PointerBuffer elements) Initializes this struct with the specified values.Copies the specified struct data to this struct.long
size()
set by libffi; you should initialize it to zero.size
(long value) Sets the specified value to thesize()
field.int
sizeof()
short
type()
for a structure, this should be set toTYPE_STRUCT
.type
(short value) Sets the specified value to thetype()
field.Methods inherited from class org.lwjgl.system.Struct
clear, free, isNull, validate
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. -
SIZE
public static final int SIZEThe struct member offsets. -
ALIGNMENT
public static final int ALIGNMENTThe struct member offsets. -
TYPE
public static final int TYPEThe struct member offsets. -
ELEMENTS
public static final int ELEMENTSThe struct member offsets.
-
-
Constructor Details
-
FFIType
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 Details
-
sizeof
public int sizeof()- Specified by:
sizeof
in classorg.lwjgl.system.Struct
-
size
public long size()set by libffi; you should initialize it to zero. -
alignment
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.
-
size
Sets the specified value to thesize()
field. -
alignment
Sets the specified value to thealignment()
field. -
type
Sets the specified value to thetype()
field. -
elements
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
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
Returns a newFFIType
instance allocated withmemAlloc
. The instance must be explicitly freed. -
calloc
Returns a newFFIType
instance allocated withmemCalloc
. The instance must be explicitly freed. -
create
Returns a newFFIType
instance allocated withBufferUtils
. -
create
Returns a newFFIType
instance for the specified memory address. -
createSafe
-
malloc
Returns a newFFIType.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
Returns a newFFIType.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
Returns a newFFIType.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
Create aFFIType.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
-
malloc
Returns a newFFIType
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
calloc
Returns a newFFIType
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
malloc
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
capacity
- the buffer capacitystack
- the stack from which to allocate
-
calloc
Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
capacity
- the buffer capacitystack
- the stack from which to allocate
-
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
.
-