![]() |
BlitzMax Extended
0.8.11
Pushing Blitz to the Max.
|
Fixed-length array object. More...
#include <blitz_array.h>
Data Fields | |
BBClass * | clas |
The class of the array. | |
int | refs |
The number of times an instance is currently used. | |
const char * | type |
The TypeTag of the data type which the array stores. | |
BBSize | dims |
The number of the array's dimensions. | |
BBSize | size |
The size of the array's data section in bytes. | |
BBSize | scales [1] |
The number of elements each dimension can hold. |
Fixed-length array object.
In BlitzMax an array is a complex data type extending BBObject. That means it is usually handled by the GC and can be stored in BBObject
pointers for convenience.
Individual elements of an array are accessed through integer indexes from 0
up to the scales[0] - 1
(zero-based indexing).
Due to its fixed-size nature, arrays should not change size without reallocating them. Although it is theoretically possible to make an array shorter by changing its scales member it is not advised to do so.
It can be assumed that every array's class is the bbArrayClass, since it's declared as a "Final Type" from the side of BlitzMax. Therefore every pointer of the type BBArray* can be used directly with the string functions instead of looking up the right one in the virtual function table (bbArrayClass.vfns).
The class of the array.
Reimplemented from BBObject.
Reimplemented in BBArrayArray, BBStringArray, BBObjectArray, BBDoubleArray, BBFloatArray, BBLongArray, BBIntArray, BBShortArray, and BBByteArray.
Referenced by bbArrayCastFromObject(), and bbArrayEndsWith().
int BBArray::refs |
The number of times an instance is currently used.
Reimplemented from BBObject.
Reimplemented in BBArrayArray, BBStringArray, BBObjectArray, BBDoubleArray, BBFloatArray, BBLongArray, BBIntArray, BBShortArray, and BBByteArray.
BBSize BBArray::scales[1] |
The number of elements each dimension can hold.
The first dimension of this array (scales[0]
) contains the number of all elements the array holds. It can be used as the array's length.
Reimplemented in BBArrayArray, BBStringArray, BBObjectArray, BBDoubleArray, BBFloatArray, BBLongArray, BBIntArray, BBShortArray, and BBByteArray.
Referenced by bbArrayClone(), bbArrayCompare(), bbArrayConcat(), bbArrayDimensions(), bbArrayEndsWith(), bbArrayEquals(), bbArrayFind(), bbArrayFindInt(), bbArrayNew1D(), bbArrayReverse(), bbArrayRotate(), bbArraySlice(), bbArraySort(), bbArrayStartsWith(), bbArrayToString(), and bbStringFromArray().
BBSize BBArray::size |
The size of the array's data section in bytes.
Reimplemented in BBArrayArray, BBStringArray, BBObjectArray, BBDoubleArray, BBFloatArray, BBLongArray, BBIntArray, BBShortArray, and BBByteArray.
Referenced by bbArrayCompare(), bbArrayConcat(), bbArrayEquals(), bbArrayFromData(), bbArrayNew1D(), and bbArraySlice().