|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jniwrapper.Parameter | +--com.jniwrapper.Union
Represents a C union
type. This parameter is initialized with several parameters representing union
members. Length of this parameter is equal to that of its longest member. A union represents only one of its members
at a time. Users should define which member the union represents by calling one of the setActiveMember
methods.
Constructor Summary | |
protected |
Union()
Preconstructs a union. |
|
Union(Parameter[] members)
Constructs a union with a given set of members. |
Method Summary | |
java.lang.Object |
clone()
|
int |
getLength()
Returns a length of the parameter in memory. |
protected void |
init(Parameter[] members)
Sets union members - order does not matter. |
void |
read(DataBuffer stackBuffer,
int offset)
Reads this parameter from a specified data source. |
void |
setActiveMember(Parameter active)
Defines the member of this union that is currently used. |
void |
setActiveMember(Parameter active,
boolean read)
Defines the member of this union that is currently used. |
protected void |
setBuffer(DataBuffer newStorage,
int newOffset)
Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer. |
void |
write(DataBuffer stackBuffer,
int offset)
Writes this parameter to a specified data source. |
Methods inherited from class com.jniwrapper.Parameter |
acceptIOPerformer, asReturnValue, equals, getAlignedLength, getBuffer, getOffset, indent, pop, push, read, toByteArray, write |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Union()
init()
method.
public Union(Parameter[] members)
setActiveMember()
method.
members
- union members - order does not matter.Method Detail |
protected void init(Parameter[] members)
protected void setBuffer(DataBuffer newStorage, int newOffset)
Parameter
setBuffer
in class Parameter
public void setActiveMember(Parameter active)
public void setActiveMember(Parameter active, boolean read)
read
is true
this member is read from the last value of this union.
This is for the case when active member can be determined only after the function call is completed.
If the union contains pointers it is recommended to set active member to null
before making such calls.
active
- new active memberread
- if true
this member is read from the last value of this union.public java.lang.Object clone()
clone
in class Parameter
public int getLength()
Parameter
sizeof()
operator.
getLength
in class Parameter
public void read(DataBuffer stackBuffer, int offset) throws MemoryAccessViolationException
Parameter
read
in class Parameter
MemoryAccessViolationException
public void write(DataBuffer stackBuffer, int offset) throws MemoryAccessViolationException
Parameter
write
in class Parameter
MemoryAccessViolationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |