|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.j2native.Argument
Argument
class is wrapper through which Java interacts with
native part. It is common parent class for all types of function arguments.
Field Summary | |
protected static byte |
JAVA_SIDE
Shows that java part should be updated |
protected static byte |
NATIVE_SIDE
Shows that native part should be updated |
Constructor Summary | |
protected |
Argument()
Default constructor of Argument |
Method Summary | |
abstract java.lang.Object |
clone()
Creates and returns a copy of this object. |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
void |
free()
To avoid memory leaks in native memory should be used this method. |
abstract void |
fromBytesValue(byte[] bytes,
int offset)
Restores itself from provided array of bytes. |
protected int |
getAlignedLength()
Returns aligned to mashine word lenght of the Argument . |
abstract int |
getLength()
Returns length in bytes. |
protected abstract boolean |
isFixedLength()
Identify if Argument is a fixed length variable. |
protected abstract void |
read(long handle,
int offset)
Reads itself from the memory. |
void |
readFromRAM(long handle,
int offset)
Public method to read Argument from the native memmory. |
protected abstract void |
readFromStack(byte[] stack,
int offset)
Read itself from stack. |
protected void |
restoreFromRAM()
Restores itself from native memory. |
protected long |
storeToRAM()
Stores itself to the native memory. |
abstract byte[] |
toBytesValue()
Encodes itself and returns it's representation as array of bytes. |
protected abstract void |
toBytesValue(byte[] bytes,
int offset)
Encodes itself to the provided array of bytes. |
protected void |
update(byte side)
This method is used to synchronize Java side and native part. |
protected abstract void |
write(long handle,
int offset)
Writes itself to the memory. |
void |
writeToRAM(long handle,
int offset)
Public method to write Argument to the native memmory. |
protected abstract void |
writeToStack(byte[] stack,
int offset)
Writes itself to stack. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final byte JAVA_SIDE
protected static final byte NATIVE_SIDE
Constructor Detail |
protected Argument()
Argument
Method Detail |
protected abstract void write(long handle, int offset) throws MemoryException
handle
- identifies location in memory where Argument
will be writtenoffset
- memory address offset
MemoryException
- if memory manipulations or memory access failedprotected abstract void read(long handle, int offset) throws MemoryException
handle
- identifies location in memory from which Argument
will be readoffset
- memory address offset
MemoryException
- if memory manipulations or memory access failedprotected abstract void writeToStack(byte[] stack, int offset)
stack
- it's byte array, where Argument
will be writtenoffset
- offset in stackprotected abstract void readFromStack(byte[] stack, int offset)
stack
- it's byte array, from which Argument
will be restoredoffset
- offset in stackprotected abstract boolean isFixedLength()
Argument
is a fixed length variable.
true
if it is so, and false
otherwisepublic abstract int getLength()
public abstract byte[] toBytesValue()
Argument
protected abstract void toBytesValue(byte[] bytes, int offset)
bytes
- array of bytes to which Argument
will be writtenoffset
- offset in arraypublic abstract void fromBytesValue(byte[] bytes, int offset)
bytes
- array of bytes from which Argument
will be restoredoffset
- offset in arrayprotected int getAlignedLength()
Argument
.
protected long storeToRAM()
Argument
takes care of memory allocation and
writes itself to this allocated memory. After all operations complete method returns this memory address.
protected void restoreFromRAM()
Argument
should be written to
native memory previously.
public void writeToRAM(long handle, int offset)
Argument
to the native memmory. This method uses
void write(long handle, int offset)
method to perform operation.
handle
- identifies location in memory where Argument
will be writtenoffset
- memory address offsetwrite(long, int)
public void readFromRAM(long handle, int offset)
Argument
from the native memmory. This method uses
void read(long handle, int offset)
method to perform operation.
handle
- identifies location in memory from which Argument
will be readoffset
- memory address offsetread(long, int)
public void free()
protected void update(byte side)
side
- identifies part that should be updatedprotected void finalize()
finalize
in class java.lang.Object
public abstract java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |