Package org.lwjgl.system.libffi
Class FFIType
- All Implemented Interfaces:
AutoCloseable
,NativeResource
,Pointer
struct ffi_type {
size_t size;
unsigned short alignment;
unsigned short type;
ffi_type * elements;
}
-
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 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
ConstructorsConstructorDescriptionFFIType
(ByteBuffer container) Creates aFFIType
instance at the current position of the specifiedByteBuffer
container. -
Method Summary
Modifier and TypeMethodDescriptionshort
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, MemoryStack stack) Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static FFIType
calloc
(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 @Nullable FFIType
createSafe
(long address) static @Nullable FFIType.Buffer
createSafe
(long address, int capacity) @Nullable PointerBuffer
elements
(int capacity) elements
(@Nullable PointerBuffer value) Sets the address of the specifiedPointerBuffer
to theelements
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, MemoryStack stack) Returns a newFFIType.Buffer
instance allocated on the specifiedMemoryStack
.static FFIType
malloc
(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 @Nullable PointerBuffer
nelements
(long struct, int capacity) Unsafe version ofelements
.static void
nelements
(long struct, @Nullable 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, @Nullable PointerBuffer elements) Initializes this struct with the specified values.Copies the specified struct data to this struct.long
size()
size
(long value) Sets the specified value to thesize
field.int
sizeof()
Returnssizeof(struct)
.short
type()
type
(short value) Sets the specified value to thetype
field.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()Description copied from class:Struct
Returnssizeof(struct)
. -
size
public long size()- Returns:
- the value of the
size
field.
-
alignment
public short alignment()- Returns:
- the value of the
alignment
field.
-
type
public short type()- Returns:
- the value of the
type
field.
-
elements
- Returns:
- a
PointerBuffer
view of the data pointed to by theelements
field.
-
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
field. -
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 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
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
Unsafe version ofelements
.
-