public abstract class Parameter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
LICENSE_TYPE |
protected static java.lang.String |
V |
Constructor and Description |
---|
Parameter(DataBuffer dataBuffer,
int offset)
Constructs a new
Parameter object that is initially stored
in a given buffer at a given offset. |
Modifier and Type | Method and Description |
---|---|
protected void |
acceptIOPerformer(IOPerformer performer,
DataBuffer buffer,
int initialOffset,
boolean isReadOperation,
boolean invokedByCallback)
Implementation 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() |
protected void |
dataBufferAssigned()
Called when new parameter data buffer assigned.
|
boolean |
equals(java.lang.Object obj)
Compares this
Parameter object to a given object. |
protected int |
getAlignedLength()
Returns a parameter length in bytes aligned to default alignment.
|
int |
getAlignmentRequirement() |
protected DataBuffer |
getDataBuffer()
Returns a current data storage.
|
protected int |
getDataBufferOffset()
Returns a current offset within data storage.
|
abstract java.lang.String |
getDebugInfo()
Return debug info for JNIWrapper parameter.
|
abstract int |
getLength()
Returns the length of the parameter in memory.
|
int |
hashCode() |
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,
boolean invokedByCallback)
Default implementation that does nothing because most primitive types do
nothing on pop.
|
void |
push(DataBuffer stackBuffer,
int offset,
boolean invokedByCallback)
Writes a parameter to a function stacks.
|
void |
read(byte[] arr,
int offset)
Reads the parameter value from a byte array.
|
void |
read(byte[] arr,
int offset,
boolean invokedByCallback)
Reads the parameter value from a byte array.
|
abstract void |
read(DataBuffer stackBuffer,
int offset,
boolean invokedByCallback)
Reads this parameter from a specified data source.
|
protected void |
setDataBuffer(DataBuffer newBuffer,
int newOffset,
boolean shouldRead)
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,
boolean invokedByCallback)
Writes this parameter to a specified data source.
|
protected static final java.lang.String V
protected static final java.lang.String LICENSE_TYPE
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.protected void dataBufferAssigned()
public abstract int getLength()
sizeof()
operator.public abstract void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
MemoryAccessViolationException
public abstract void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
MemoryAccessViolationException
protected void setDataBuffer(DataBuffer newBuffer, int newOffset, boolean shouldRead)
protected DataBuffer getDataBuffer()
protected int getDataBufferOffset()
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
- a value to compare this object to.true
if two objects are equal.public int hashCode()
hashCode
in class java.lang.Object
public abstract java.lang.Object clone()
clone
in class java.lang.Object
protected int getAlignedLength()
public int getAlignmentRequirement()
public void push(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
MemoryAccessViolationException
public void pop(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
MemoryAccessViolationException
protected Parameter asReturnValue()
this
protected void acceptIOPerformer(IOPerformer performer, DataBuffer buffer, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
performer
is responsible for reading and writing 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
- a visitor responsible for I/Oing the parameter.buffer
- data buffer for I/O operation.initialOffset
- I/O operation offset of this parameter in the
buffer.public void write(byte[] arr, int offset)
public void read(byte[] arr, int offset)
public void read(byte[] arr, int offset, boolean invokedByCallback)
public static byte[] toByteArray(Parameter param)
protected static java.lang.String indent(java.lang.String param, int size)
public abstract java.lang.String getDebugInfo()