Package jnr.ffi
Class StructLayout.NumberField
- java.lang.Object
-
- jnr.ffi.StructLayout.Field
-
- jnr.ffi.StructLayout.NumberField
-
- Direct Known Subclasses:
StructLayout.Double
,StructLayout.EnumField
,StructLayout.Float
,StructLayout.IntegerAlias
,StructLayout.Pointer
,StructLayout.Signed16
,StructLayout.Signed32
,StructLayout.Signed64
,StructLayout.Signed8
,StructLayout.SignedLong
,StructLayout.Unsigned16
,StructLayout.Unsigned32
,StructLayout.Unsigned64
,StructLayout.Unsigned8
,StructLayout.UnsignedLong
- Enclosing class:
- StructLayout
protected abstract class StructLayout.NumberField extends StructLayout.Field
Base class for all Number structure fields.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumberField(NativeType nativeType)
protected
NumberField(NativeType nativeType, StructLayout.Offset offset)
protected
NumberField(Type type)
protected
NumberField(Type type, StructLayout.Offset offset)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description byte
byteValue(Pointer ptr)
Returns abyte
representation of thisNumber
.double
doubleValue(Pointer ptr)
Returns anfloat
representation of thisNumber
.float
floatValue(Pointer ptr)
Returns anfloat
representation of thisNumber
.abstract int
intValue(Pointer ptr)
Returns aint
representation of thisNumber
.long
longValue(Pointer ptr)
Returns along
representation of thisNumber
.abstract void
set(Pointer ptr, java.lang.Number value)
Sets the field to a new value.short
shortValue(Pointer ptr)
Returns ashort
representation of thisNumber
.java.lang.String
toString(Pointer ptr)
Returns a string representation of thisNumber
.-
Methods inherited from class jnr.ffi.StructLayout.Field
enclosing, offset
-
-
-
-
Field Detail
-
type
protected final Type type
-
-
Constructor Detail
-
NumberField
protected NumberField(NativeType nativeType)
-
NumberField
protected NumberField(Type type)
-
NumberField
protected NumberField(NativeType nativeType, StructLayout.Offset offset)
-
NumberField
protected NumberField(Type type, StructLayout.Offset offset)
-
-
Method Detail
-
set
public abstract void set(Pointer ptr, java.lang.Number value)
Sets the field to a new value.- Parameters:
ptr
- The pointer to the field.value
- The new value.
-
doubleValue
public double doubleValue(Pointer ptr)
Returns anfloat
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- an
float
value for thisNumber
.
-
floatValue
public float floatValue(Pointer ptr)
Returns anfloat
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- an
float
value for thisNumber
.
-
byteValue
public byte byteValue(Pointer ptr)
Returns abyte
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- a
byte
value for thisNumber
.
-
shortValue
public short shortValue(Pointer ptr)
Returns ashort
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- a
short
value for thisNumber
.
-
intValue
public abstract int intValue(Pointer ptr)
Returns aint
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- a
int
value for thisNumber
.
-
longValue
public long longValue(Pointer ptr)
Returns along
representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- a
long
value for thisNumber
.
-
toString
public java.lang.String toString(Pointer ptr)
Returns a string representation of thisNumber
.- Parameters:
ptr
- The pointer to the field.- Returns:
- a string representation of this
Number
.
-
-