com.jniwrapper
Class DelegatingParameter

java.lang.Object
  extended by com.jniwrapper.Parameter
      extended by com.jniwrapper.DelegatingParameter
Direct Known Subclasses:
BitField, Bool, Const, Int, LongInt, OutOnly, ShortInt, UInt, ULongInt, UnicodeChar, Unused, UShortInt, WideChar

public abstract class DelegatingParameter
extends Parameter

Base class for all parameter types that wrap around other types. Implements the Proxy pattern for the Parameter type.


Field Summary
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
DelegatingParameter(Parameter value)
           
 
Method Summary
protected  void acceptIOPerformer(IOPerformer performer, DataBuffer source, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
          Implementation of a Visitor pattern for parameter IO.
protected  DataBuffer getDataBuffer()
          Returns a current data storage.
protected  int getDataBufferOffset()
          Returns a current offset within data storage.
 java.lang.String getDebugInfo()
          Return debug info for JNIWrapper parameter.
 int getLength()
          Returns the length of the parameter in memory.
protected  Parameter getValueObject()
           
 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(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Reads this parameter from a specified data source.
protected  void setDataBuffer(DataBuffer newSource, int newOffset, boolean shouldRead)
          Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.
protected  void setValueObject(Parameter value)
           
 java.lang.String toString()
           
 void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Writes this parameter to a specified data source.
 
Methods inherited from class com.jniwrapper.Parameter
asReturnValue, clone, dataBufferAssigned, equals, getAlignedLength, getAlignmentRequirement, hashCode, indent, read, read, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegatingParameter

public DelegatingParameter(Parameter value)
Method Detail

acceptIOPerformer

protected void acceptIOPerformer(IOPerformer performer,
                                 DataBuffer source,
                                 int initialOffset,
                                 boolean isReadOperation,
                                 boolean invokedByCallback)
Description copied from class: Parameter
Implementation of a Visitor pattern for parameter IO. A 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.

Overrides:
acceptIOPerformer in class Parameter
Parameters:
performer - a visitor responsible for I/Oing the parameter.
source - data buffer for I/O operation.
initialOffset - I/O operation offset of this parameter in the buffer.

setDataBuffer

protected void setDataBuffer(DataBuffer newSource,
                             int newOffset,
                             boolean shouldRead)
Description copied from class: Parameter
Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.

Overrides:
setDataBuffer in class Parameter

getDataBuffer

protected DataBuffer getDataBuffer()
Description copied from class: Parameter
Returns a current data storage.

Overrides:
getDataBuffer in class Parameter

getDataBufferOffset

protected int getDataBufferOffset()
Description copied from class: Parameter
Returns a current offset within data storage.

Overrides:
getDataBufferOffset in class Parameter

getValueObject

protected Parameter getValueObject()

setValueObject

protected void setValueObject(Parameter value)

getLength

public int getLength()
Description copied from class: Parameter
Returns the length of the parameter in memory. This method is similar to C sizeof() operator.

Specified by:
getLength in class Parameter

write

public void write(DataBuffer stackBuffer,
                  int offset,
                  boolean invokedByCallback)
           throws MemoryAccessViolationException
Description copied from class: Parameter
Writes this parameter to a specified data source.

Specified by:
write in class Parameter
Throws:
MemoryAccessViolationException

read

public void read(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Description copied from class: Parameter
Reads this parameter from a specified data source.

Specified by:
read in class Parameter
Throws:
MemoryAccessViolationException

push

public void push(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Description copied from class: Parameter
Writes a parameter to a function stacks.

Overrides:
push in class Parameter
Throws:
MemoryAccessViolationException

pop

public void pop(DataBuffer stackBuffer,
                int offset,
                boolean invokedByCallback)
         throws MemoryAccessViolationException
Description copied from class: Parameter
Default implementation that does nothing because most primitive types do nothing on pop. Reads a parameter from a function stack.

Overrides:
pop in class Parameter
Throws:
MemoryAccessViolationException

getDebugInfo

public java.lang.String getDebugInfo()
Description copied from class: Parameter
Return debug info for JNIWrapper parameter.

Specified by:
getDebugInfo in class Parameter
Returns:
debug info

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object