- java.lang.Object
-
- jnr.ffi.Struct.Member
-
- jnr.ffi.Struct.NumberField
-
- jnr.ffi.Struct.PointerField
-
- jnr.ffi.Struct.StructRef<T>
-
- Type Parameters:
T
- - Struct type
- Enclosing class:
- Struct
public class Struct.StructRef<T extends Struct> extends Struct.PointerField
Represents a reference to a Struct or and array of Structs
-
-
Field Summary
-
Fields inherited from class jnr.ffi.Struct.NumberField
type
-
-
Constructor Summary
Constructors Constructor Description StructRef(java.lang.Class<T> structType)
StructRef(java.lang.Class<T> structType, int initialStructCount)
StructRef(Struct.Offset offset, java.lang.Class<T> structType)
StructRef(Struct.Offset offset, java.lang.Class<T> structType, int initialStructCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
T[]
get(int length)
void
set(T struct)
void
set(T[] structs)
java.lang.String
toString()
Returns a string representation of thisPointer
.-
Methods inherited from class jnr.ffi.Struct.PointerField
getPointer, intValue, longValue, set, set, size
-
Methods inherited from class jnr.ffi.Struct.NumberField
byteValue, doubleValue, floatValue, getMemory, offset, shortValue, struct
-
-
-
-
Constructor Detail
-
StructRef
public StructRef(java.lang.Class<T> structType)
-
StructRef
public StructRef(java.lang.Class<T> structType, int initialStructCount)
- Parameters:
structType
- Struct typeinitialStructCount
- the number of struct instances. Use this to allocate memory without setting value.
-
StructRef
public StructRef(Struct.Offset offset, java.lang.Class<T> structType)
-
StructRef
public StructRef(Struct.Offset offset, java.lang.Class<T> structType, int initialStructCount)
- Parameters:
offset
- offset of the fieldstructType
- Struct typeinitialStructCount
- the number of struct instances. Use this to allocate memory without setting value.
-
-
Method Detail
-
set
public final void set(T struct)
-
set
public final void set(T[] structs)
-
get
public final T get()
- Returns:
- struct from memory
-
get
public final T[] get(int length)
- Parameters:
length
- the length of struct in memory to get- Returns:
- struct from memory
-
toString
public java.lang.String toString()
Description copied from class:Struct.PointerField
Returns a string representation of thisPointer
.- Overrides:
toString
in classStruct.PointerField
- Returns:
- a string representation of this
Pointer
.
-
-