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.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct member offsets.static 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
ConstructorsConstructorDescriptionFFIType(ByteBuffer container) Creates aFFITypeinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionshortalignment(short value) Sets the specified value to thealignmentfield.static FFITypecalloc()Returns a newFFITypeinstance allocated withmemCalloc.static FFIType.Buffercalloc(int capacity) Returns a newFFIType.Bufferinstance allocated withmemCalloc.static FFIType.Buffercalloc(int capacity, MemoryStack stack) Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static FFITypecalloc(MemoryStack stack) Returns a newFFITypeinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static FFITypecreate()Returns a newFFITypeinstance allocated withBufferUtils.static FFIType.Buffercreate(int capacity) Returns a newFFIType.Bufferinstance allocated withBufferUtils.static FFITypecreate(long address) Returns a newFFITypeinstance for the specified memory address.static FFIType.Buffercreate(long address, int capacity) Create aFFIType.Bufferinstance at the specified memory.static @Nullable FFITypecreateSafe(long address) static @Nullable FFIType.BuffercreateSafe(long address, int capacity) @Nullable PointerBufferelements(int capacity) elements(@Nullable PointerBuffer value) Sets the address of the specifiedPointerBufferto theelementsfield.static FFITypemalloc()Returns a newFFITypeinstance allocated withmemAlloc.static FFIType.Buffermalloc(int capacity) Returns a newFFIType.Bufferinstance allocated withmemAlloc.static FFIType.Buffermalloc(int capacity, MemoryStack stack) Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStack.static FFITypemalloc(MemoryStack stack) Returns a newFFITypeinstance allocated on the specifiedMemoryStack.static shortnalignment(long struct) Unsafe version ofalignment().static voidnalignment(long struct, short value) Unsafe version ofalignment.static @Nullable PointerBuffernelements(long struct, int capacity) Unsafe version ofelements.static voidnelements(long struct, @Nullable PointerBuffer value) Unsafe version ofelements.static longnsize(long struct) Unsafe version ofsize().static voidnsize(long struct, long value) Unsafe version ofsize.static shortntype(long struct) Unsafe version oftype().static voidntype(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.longsize()size(long value) Sets the specified value to thesizefield.intsizeof()Returnssizeof(struct).shorttype()type(short value) Sets the specified value to thetypefield.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. -
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 aFFITypeinstance 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). -
size
public long size()- Returns:
- the value of the
sizefield.
-
alignment
public short alignment()- Returns:
- the value of the
alignmentfield.
-
type
public short type()- Returns:
- the value of the
typefield.
-
elements
- Returns:
- a
PointerBufferview of the data pointed to by theelementsfield.
-
size
Sets the specified value to thesizefield. -
alignment
Sets the specified value to thealignmentfield. -
type
Sets the specified value to thetypefield. -
elements
Sets the address of the specifiedPointerBufferto theelementsfield. -
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 newFFITypeinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newFFITypeinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newFFITypeinstance allocated withBufferUtils. -
create
Returns a newFFITypeinstance for the specified memory address. -
createSafe
-
malloc
Returns a newFFIType.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newFFIType.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newFFIType.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aFFIType.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newFFITypeinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newFFITypeinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStackand 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.
-