FixObjectArray
This container is created by a FixObjectFactory
and can be used like a ordinary Array
. It allows subscript operations for inserting & fetching values and range-based for loops:
const var f1 = Engine.createFixObjectFactory({
"value": 0
});
const var list = f1.createArray(128);
for(s in list)
{
s.value = 90;
}
list[12].value = 20;
const var x = list[90].value;
There are also a few methods copied from the Array
class, however for dynamic insertion and removal (like with push()
or removeElement()
) it's highly recommended to use the FixObjectStack
class instead.
Class methods
clear
Clears the array (resets all objects to their default.
FixObjectArray.clear()
This operation might be slower than Array.clear()
because it has to iterate all elements.
contains
checks if the array contains the object.
FixObjectArray.contains(var obj)
This will use the comparison function defined by FixObjectFactory.setCompareFunction()
in order to define equality of two elements.
copy
Copies the property from each element into a buffer (or array). Edit on GitHub
FixObjectArray.copy(String propertyName, var target)
fill
Fills the array with the given object. Edit on GitHub
FixObjectArray.fill(var obj)
fromBase64
Restores an array from a previously exported state. Edit on GitHub
FixObjectArray.fromBase64( String b64)
indexOf
Returns the index of the first element that matches the given object.
FixObjectArray.indexOf(var obj)
This will use the comparison function defined by FixObjectFactory.setCompareFunction()
in order to define equality of two elements.
size
Returns the size of the array.
FixObjectArray.size()
This will always return the size that was passed into the constructor (unlike the stack object which will return the number of used slots).
sort
Sorts the array with the given compare function.
FixObjectArray.sort()
This will use the comparison function defined by FixObjectFactory.setCompareFunction()
in order to define equality of two elements.
toBase64
Exports the memory region of the entire array as Base64 encoded string. Edit on GitHub
FixObjectArray.toBase64()