Logo Search packages:      
Sourcecode: libjna-java version File versions  Download package

com::sun::jna::Structure Class Reference

Inheritance diagram for com::sun::jna::Structure:

com::sun::jna::examples::win32::Kernel32::FILE_NOTIFY_INFORMATION com::sun::jna::examples::win32::User32::POINT com::sun::jna::examples::win32::User32::SIZE com::sun::jna::Structure::FFIType com::sun::jna::Union

List of all members.


Detailed Description

Represents a native structure with a Java peer class. When used as a function parameter or return value, this class corresponds to struct*. When used as a field within another Structure, it corresponds to struct. The tagging interfaces ByReference and ByValue may be used to alter the default behavior.

See the overview for supported type mappings.

Structure alignment and type mappings are derived by default from the enclosing interface definition (if any) by using Native#getStructureAlignment and Native#getTypeMapper.

Structure fields corresponding to native fields must be public. The may additionally have the following modifiers:

NOTE: Strings are used to represent native C strings because usage of char * is generally more common than wchar_t *.

NOTE: This class assumes that fields are returned in Class#getFields in the same or reverse order as declared. If your VM returns them in no particular order, you're out of luck.

Author:
Todd Fast, todd.fast@sun.com

twall@users.sf.net

Definition at line 58 of file Structure.java.


Public Member Functions

void clear ()
boolean equals (Object o)
Pointer getPointer ()
int hashCode ()
void read ()
Object readField (String name)
int size ()
Structure[] toArray (int size)
Structure[] toArray (Structure[] array)
String toString ()
void write ()
void writeField (String name)

Static Public Member Functions

static Structure newInstance (Class type) throws IllegalArgumentException

Static Public Attributes

static final int ALIGN_DEFAULT = 0
static final int ALIGN_GNUC = 2
static final int ALIGN_MSVC = 3
static final int ALIGN_NONE = 1

Protected Member Functions

void allocateMemory (int size)
void allocateMemory ()
void ensureAllocated ()
int getNativeAlignment (Class type, Object value, boolean isFirstElement)
int getStructAlignment ()
void setAlignType (int alignType)
void setTypeMapper (TypeMapper mapper)
 Structure (int size, int alignment)
 Structure (int size)
void useMemory (Pointer m, int offset)
void useMemory (Pointer m)

Static Protected Attributes

static final int CALCULATE_SIZE = -1

Package Functions

int calculateAlignedSize (int calculatedSize)
int calculateSize (boolean force)
Map fields ()
Object getField (StructField structField)
Pointer getTypeInfo ()
Object readField (StructField structField)
void writeField (StructField structField)

Static Package Functions

 [static initializer]
static Pointer getTypeInfo (Object obj)
static Structure updateStructureByReference (Class type, Structure s, Pointer address)

Static Package Attributes

static final boolean isPPC
static final boolean isSPARC

Private Member Functions

String format (Class type)
void readArrayValue (int offset, Object o, Class cls)
Object readValue (int offset, Class nativeType, Object currentValue)
void setField (StructField structField, Object value)
String toString (int indent)
boolean writeArrayValue (int offset, Object value, Class cls)
boolean writeValue (int offset, Object value, Class nativeType)

Static Private Member Functions

static int getNativeSize (Class type, Object value)

Private Attributes

int alignType
Pointer memory
final Map nativeStrings = new HashMap()
int size = CALCULATE_SIZE
int structAlignment
final Map structFields = new LinkedHashMap()
long typeInfo
TypeMapper typeMapper

Static Private Attributes

static final int MAX_GNUC_ALIGNMENT = isSPARC ? 8 : NativeLong.SIZE
static Set reading = new HashSet()
static final boolean REVERSE_FIELDS
static Set writing = new HashSet()

Classes

interface  ByReference
interface  ByValue
class  FFIType
class  MemberOrder
class  StructField

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index