com.jniwrapper
Class ComplexArray

java.lang.Object
  |
  +--com.jniwrapper.Parameter
        |
        +--com.jniwrapper.Structure
              |
              +--com.jniwrapper.ComplexArray
All Implemented Interfaces:
ArrayParameter

public class ComplexArray
extends Structure
implements ArrayParameter

Represents an array of objects.

All objects in array must have the same type.

Note: If function takes an array as its parameter, you should take Pointer referencing that ComplexArray object, instead of direct taking ComplexArray instance.


Constructor Summary
ComplexArray(Parameter[] arr)
          Constructs array object taking specified Parameter array.
ComplexArray(Parameter sample, int count)
          Constructs array object.
 
Method Summary
static void arrayCopy(ComplexArray from, ComplexArray to)
           
 java.lang.Object clone()
           
 void forceElementCount(int elementCount)
          Sets new array size without memory reallocation.
 void fromParameterArray(Parameter[] params)
          Sets array content to the given values.
 int getAlignmentRequirement()
           
 Parameter getElement(int i)
          Returns array item specified by an index.
 int getElementCount()
          Returns the number of elements in the array.
 void setElement(int i, Parameter elem)
          Replaces 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.
 
Methods inherited from class com.jniwrapper.Structure
acceptIOPerformer, addMembers, computeLength, getLength, getMember, getMembers, init, init, pop, push, read, setDataBuffer, write
 
Methods inherited from class com.jniwrapper.Parameter
asReturnValue, equals, getAlignedLength, getDataBuffer, getDataBufferOffset, indent, read, toByteArray
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplexArray

public ComplexArray(Parameter[] arr)
Constructs array object taking specified Parameter array.


ComplexArray

public ComplexArray(Parameter sample,
                    int count)
Constructs array object. Fills it with copies of sample object.

Parameters:
sample - Sample for items in constructed array
count - Count of items in constructed array
Method Detail

write

public void write(byte[] arr,
                  int offset)
Description copied from class: Parameter
Writes the parameter value to a byte array.

Overrides:
write in class Parameter

clone

public java.lang.Object clone()
Overrides:
clone in class Structure

getElement

public Parameter getElement(int i)
Description copied from interface: ArrayParameter
Returns array item specified by an index.

Specified by:
getElement in interface ArrayParameter
Parameters:
i - index of requested array item

setElement

public void setElement(int i,
                       Parameter elem)
Description copied from interface: ArrayParameter
Replaces array item with the specified object.

Specified by:
setElement in interface ArrayParameter
Parameters:
i - index of an item to be replaced
elem - object to be set as array item

getElementCount

public int getElementCount()
Description copied from interface: ArrayParameter
Returns the number of elements in the array.

Specified by:
getElementCount in interface ArrayParameter

toParameterArray

public Parameter[] toParameterArray()
Description copied from interface: ArrayParameter
Returns items as Java array.

Specified by:
toParameterArray in interface ArrayParameter

fromParameterArray

public void fromParameterArray(Parameter[] params)
Description copied from interface: ArrayParameter
Sets array content to the given values.

Specified by:
fromParameterArray in interface ArrayParameter

toString

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

forceElementCount

public void forceElementCount(int elementCount)
Description copied from interface: ArrayParameter
Sets new array size without memory reallocation. This method should be used with caution as the array may access invalid memory area if an incorrect value is passed in the argument.

Specified by:
forceElementCount in interface ArrayParameter

setElementCount

public void setElementCount(int elementCount)
Description copied from interface: ArrayParameter
Resizes this array to a given size.

Specified by:
setElementCount in interface ArrayParameter

arrayCopy

public static void arrayCopy(ComplexArray from,
                             ComplexArray to)

getAlignmentRequirement

public int getAlignmentRequirement()
Overrides:
getAlignmentRequirement in class Structure