|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jniwrapper.Parameter
Common parent class for all types of function parameters.
Constructor Summary | |
Parameter(DataBuffer dataBuffer,
int offset)
Constructs a new Parameter object that is initially stored in a
given buffer at a given offset. |
Method Summary | |
protected void |
acceptIOPerformer(IOPerformer performer,
DataBuffer buffer,
int initialOffset)
Realization of a Visitor pattern for parameter IO. |
protected Parameter |
asReturnValue()
Returns a parameter that represents this one as a return value. |
abstract java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object obj)
Compares this Parameter object to a given object. |
protected int |
getAlignedLength()
Returns parameter length in bytes aligned to default alignment. |
protected DataBuffer |
getBuffer()
Returns current data storage. |
abstract int |
getLength()
Returns a length of the parameter in memory. |
protected int |
getOffset()
Returns current offset within data storage. |
protected static java.lang.String |
indent(java.lang.String param,
int size)
Utility method used for readable output in toString(). |
void |
pop(DataBuffer stackBuffer,
int offset)
Default implementation, which does nothing as most primitive types do nothing on pop. |
void |
push(DataBuffer stackBuffer,
int offset)
Writes a parameter to a function stacks |
void |
read(byte[] arr,
int offset)
Reads the parameter value from a byte array. |
abstract void |
read(DataBuffer stackBuffer,
int offset)
Reads this parameter from a specified data source. |
protected void |
setBuffer(DataBuffer newBuffer,
int newOffset)
Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer. |
static byte[] |
toByteArray(Parameter param)
Converts a parameter to a byte array. |
void |
write(byte[] arr,
int offset)
Writes the parameter value to a byte array. |
abstract void |
write(DataBuffer stackBuffer,
int offset)
Writes this parameter to a specified data source. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Parameter(DataBuffer dataBuffer, int offset)
Parameter
object that is initially stored in a
given buffer at a given offset.
dataBuffer
- initial data buffer where this parameter should be stored.offset
- offset in the given data buffer where this parameter should be stored.Method Detail |
public abstract int getLength()
sizeof()
operator.
public abstract void write(DataBuffer stackBuffer, int offset) throws MemoryAccessViolationException
MemoryAccessViolationException
public abstract void read(DataBuffer stackBuffer, int offset) throws MemoryAccessViolationException
MemoryAccessViolationException
protected void setBuffer(DataBuffer newBuffer, int newOffset)
protected DataBuffer getBuffer()
protected int getOffset()
public boolean equals(java.lang.Object obj)
Parameter
object to a given object.
Two Parameter
objects are considered equal if their
byte representations are equal and they are of the same type.
Subclasses may override this method as appropriate.
equals
in class java.lang.Object
obj
- value to compare this object to
true
if two objects are equal.public abstract java.lang.Object clone()
clone
in class java.lang.Object
protected int getAlignedLength()
public void push(DataBuffer stackBuffer, int offset)
public void pop(DataBuffer stackBuffer, int offset) throws MemoryAccessViolationException
MemoryAccessViolationException
protected Parameter asReturnValue()
this
protected void acceptIOPerformer(IOPerformer performer, DataBuffer buffer, int initialOffset)
performer
is responsible for I/Oing the
parameter. Users implementing a complex parameter from scratch (i.e. not by extending a pre-existing class
such as Structure
or Pointer
) may wish to override this method to make a performer
visit object internal parts.
performer
- visitor responsible for I/Oing the parameterbuffer
- data buffer for I/O operationinitialOffset
- I/O operation offset of this parameter in the bufferpublic void write(byte[] arr, int offset)
public void read(byte[] arr, int offset)
public static final byte[] toByteArray(Parameter param)
protected static java.lang.String indent(java.lang.String param, int size)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |