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.NativeResourceContains information about a libffi type.Layout
struct ffi_type { size_tsize(); unsigned shortalignment(); unsigned shorttype(); ffi_type *elements(int); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFFIType.BufferAn array ofFFITypestructs.
-
Constructor Summary
Constructors Constructor Description FFIType(java.nio.ByteBuffer container)Creates aFFITypeinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description shortalignment()set by libffi; you should initialize it to zero.FFITypealignment(short value)Sets the specified value to thealignment()field.static FFITypecalloc()Returns a newFFITypeinstance allocated withmemCalloc.static FFIType.Buffercalloc(int capacity)Returns a newFFIType.Bufferinstance allocated withmemCalloc.static FFIType.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static FFITypecalloc(org.lwjgl.system.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 FFITypecreateSafe(long address)static FFIType.BuffercreateSafe(long address, int capacity)org.lwjgl.PointerBufferelements(int capacity)FFITypeelements(org.lwjgl.PointerBuffer value)Sets the address of the specifiedPointerBufferto theelements(int)field.static FFITypemalloc()Returns a newFFITypeinstance allocated withmemAlloc.static FFIType.Buffermalloc(int capacity)Returns a newFFIType.Bufferinstance allocated withmemAlloc.static FFIType.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newFFIType.Bufferinstance allocated on the specifiedMemoryStack.static FFITypemalloc(org.lwjgl.system.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 org.lwjgl.PointerBuffernelements(long struct, int capacity)Unsafe version ofelements.static voidnelements(long struct, org.lwjgl.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.FFITypeset(long size, short alignment, short type, org.lwjgl.PointerBuffer elements)Initializes this struct with the specified values.FFITypeset(FFIType src)Copies the specified struct data to this struct.longsize()set by libffi; you should initialize it to zero.FFITypesize(long value)Sets the specified value to thesize()field.intsizeof()shorttype()for a structure, this should be set toTYPE_STRUCT.FFITypetype(short value)Sets the specified value to thetype()field.
-
-
-
Constructor Detail
-
FFIType
public FFIType(java.nio.ByteBuffer container)
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 Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin 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_typeobjects. 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 specifiedPointerBufferto 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 newFFITypeinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static FFIType calloc()
Returns a newFFITypeinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static FFIType create()
Returns a newFFITypeinstance allocated withBufferUtils.
-
create
public static FFIType create(long address)
Returns a newFFITypeinstance for the specified memory address.
-
createSafe
@Nullable public static FFIType createSafe(long address)
-
malloc
public static FFIType.Buffer malloc(int capacity)
Returns a newFFIType.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static FFIType.Buffer calloc(int capacity)
Returns a newFFIType.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static FFIType.Buffer create(int capacity)
Returns a newFFIType.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static FFIType.Buffer create(long address, int capacity)
Create aFFIType.Bufferinstance 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 newFFITypeinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static FFIType calloc(org.lwjgl.system.MemoryStack stack)
Returns a newFFITypeinstance allocated on the specifiedMemoryStackand 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.Bufferinstance 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.Bufferinstance allocated on the specifiedMemoryStackand 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.
-
-