jnr.ffi
Class StructLayout

java.lang.Object
  extended by jnr.ffi.StructLayout
All Implemented Interfaces:
Type

public class StructLayout
extends Object
implements Type


Nested Class Summary
protected  class StructLayout.AbstractBoolean
          Base class for Boolean fields
protected  class StructLayout.AbstractField
          Base implementation of Member
protected  class StructLayout.Boolean
          A normal C boolean - 1 byte in size
 class StructLayout.Double
           
protected static interface StructLayout.Field
          Interface all Struct members must implement.
 class StructLayout.Float
           
protected  class StructLayout.NumberField
          Base class for all Number structure fields.
protected  class StructLayout.Padding
          Specialized padding fields for structs.
 class StructLayout.Pointer
          Represents a native memory address.
 class StructLayout.Signed16
          A 16 bit signed integer field.
 class StructLayout.Signed32
          A 32 bit signed integer field.
 class StructLayout.Signed64
          A 64 bit signed integer field.
 class StructLayout.Signed8
          An 8 bit signed integer
 class StructLayout.SignedLong
          A native long integer field.
 class StructLayout.Unsigned16
          A 16 bit signed integer field.
 class StructLayout.Unsigned32
          A 32 bit signed integer field.
 class StructLayout.Unsigned64
          A 64 bit unsigned integer field.
 class StructLayout.Unsigned8
          An 8 bit unsigned integer
 class StructLayout.UnsignedLong
          A native long integer field.
protected  class StructLayout.WBOOL
          A Windows BOOL - 4 bytes
 
Constructor Summary
protected StructLayout(Runtime runtime)
          Creates a new StructLayout.
 
Method Summary
protected  int addField(int fieldSize, int fieldAlign)
           
protected  int addField(int fieldSize, int fieldAlign, int offset)
           
protected  int addField(int fieldSize, int fieldAlign, Struct.Offset offset)
           
protected  int addField(Type t)
           
protected  int addField(Type t, int offset)
           
protected  int addField(Type t, Struct.Offset offset)
           
 int alignment()
          The native alignment of this type, in bytes
protected
<T extends StructLayout.Field>
T[]
array(T[] array)
          Creates an array of Member instances.
protected  void arrayBegin()
          Starts an array construction session
protected  void arrayEnd()
          Ends an array construction session
 NativeType getNativeType()
          The native type of this type
 Runtime getRuntime()
           
protected
<T extends StructLayout>
T
inner(T structLayout)
           
 int size()
          The size in bytes of this type.
 String toString()
          Returns a human readable String representation of the structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StructLayout

protected StructLayout(Runtime runtime)
Creates a new StructLayout.

Method Detail

getRuntime

public final Runtime getRuntime()

size

public final int size()
Description copied from interface: Type
The size in bytes of this type.

Specified by:
size in interface Type
Returns:
An integer

alignment

public final int alignment()
Description copied from interface: Type
The native alignment of this type, in bytes

Specified by:
alignment in interface Type
Returns:
An integer

getNativeType

public NativeType getNativeType()
Description copied from interface: Type
The native type of this type

Specified by:
getNativeType in interface Type
Returns:
the native type of this type

toString

public String toString()
Returns a human readable String representation of the structure.

Overrides:
toString in class Object
Returns:
a String representation of this structure.

addField

protected final int addField(int fieldSize,
                             int fieldAlign,
                             int offset)

addField

protected final int addField(int fieldSize,
                             int fieldAlign,
                             Struct.Offset offset)

addField

protected final int addField(int fieldSize,
                             int fieldAlign)

addField

protected final int addField(Type t)

addField

protected final int addField(Type t,
                             int offset)

addField

protected final int addField(Type t,
                             Struct.Offset offset)

arrayBegin

protected final void arrayBegin()
Starts an array construction session


arrayEnd

protected final void arrayEnd()
Ends an array construction session


array

protected <T extends StructLayout.Field> T[] array(T[] array)
Creates an array of Member instances.

Type Parameters:
T - The type of the Member subclass to create.
Parameters:
array - the array to store the instances in
Returns:
the array that was passed in

inner

protected final <T extends StructLayout> T inner(T structLayout)


Copyright © 2012. All Rights Reserved.