public class ComplexArray extends Structure implements ArrayParameter
All objects in the array must have the same type.
Note: If a function takes an array as its parameter, you should take Pointer referencing that ComplexArray object, instead of direct taking the ComplexArray instance.
LICENSE_TYPE, V| Constructor and Description |
|---|
ComplexArray(Parameter[] arr)
Constructs an array object taking a specified
Parameter
array. |
ComplexArray(Parameter sample,
int count)
Constructs an array object.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
acceptIOPerformer(IOPerformer performer,
DataBuffer source,
int initialOffset,
boolean isReadOperation,
boolean invokedByCallback)
Implementation of a Visitor pattern for parameter IO.
|
static void |
arrayCopy(ComplexArray from,
ComplexArray to)
Copy ComplexArray content
|
java.lang.Object |
clone() |
void |
forceElementCount(int elementCount)
Sets a new array size without memory reallocation.
|
void |
fromParameterArray(Parameter[] params)
Sets array contents to the given values.
|
int |
getAlignmentRequirement() |
Parameter |
getElement(int i)
Returns an array item specified by an index.
|
int |
getElementCount()
Returns the number of elements in the array.
|
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.
|
void |
setElement(int i,
Parameter elem)
Replaces an array item with the specified object.
|
void |
setElementCount(int elementCount)
Resizes this array to a given size.
|
Parameter[] |
toParameterArray()
Returns items as Java array.
|
java.lang.String |
toString() |
void |
write(byte[] arr,
int offset)
Writes the parameter value to a byte array.
|
void |
write(DataBuffer stackBuffer,
int offset,
boolean invokedByCallback)
Writes this parameter to a specified data source.
|
addMembers, computeLength, equals, getDebugInfo, getFirstMemberSize, getLength, getMember, getMembers, getOffsets, init, init, initFromasReturnValue, dataBufferAssigned, getAlignedLength, getDataBuffer, getDataBufferOffset, hashCode, indent, read, read, toByteArraypublic ComplexArray(Parameter[] arr)
Parameter
array.public ComplexArray(Parameter sample, int count)
sample - a sample for items in the constructed arraycount - count of items in the constructed arraypublic void write(byte[] arr,
int offset)
Parameterpublic Parameter getElement(int i)
ArrayParametergetElement in interface ArrayParameteri - index of a requested array itempublic void setElement(int i,
Parameter elem)
ArrayParametersetElement in interface ArrayParameteri - index of an item to be replacedelem - object to be set as array itemprotected void setDataBuffer(DataBuffer newSource, int newOffset, boolean shouldRead)
ParametersetDataBuffer in class Structureprotected void acceptIOPerformer(IOPerformer performer, DataBuffer source, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
Parameterperformer 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.acceptIOPerformer in class Structureperformer - 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.public void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameterwrite in class StructureMemoryAccessViolationExceptionpublic void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameterread in class StructureMemoryAccessViolationExceptionpublic void push(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameterpush in class StructureMemoryAccessViolationExceptionpublic void pop(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameterpop in class StructureMemoryAccessViolationExceptionpublic int getElementCount()
ArrayParametergetElementCount in interface ArrayParameterpublic Parameter[] toParameterArray()
ArrayParametertoParameterArray in interface ArrayParameterpublic void fromParameterArray(Parameter[] params)
ArrayParameterfromParameterArray in interface ArrayParameterpublic java.lang.String toString()
toString in class java.lang.Objectpublic void forceElementCount(int elementCount)
ArrayParameterforceElementCount in interface ArrayParameterpublic void setElementCount(int elementCount)
ArrayParametersetElementCount in interface ArrayParameterpublic static void arrayCopy(ComplexArray from, ComplexArray to)
from - sourceto - destinationpublic int getAlignmentRequirement()
getAlignmentRequirement in class Structure