BlitzMax Extended  0.8.17
Pushing Blitz to the Max.
Data Fields
BBArray Struct Reference

Fixed-length array object. More...

#include <blitz_array.h>

+ Inheritance diagram for BBArray:

Data Fields

BBClassclas
 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.
- Data Fields inherited from BBObject

Additional Inherited Members

- Protected Attributes inherited from BBObject

Detailed Description

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).


Field Documentation

BBClass* BBArray::clas

The class of the array.

Warning:
Should always point to bbArrayClass
See also:
bbArrayClass

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.

Note:
Only used in single-threaded mode (by the reference-counting GC).
Warning:
Do not change or read this manually, as it is controlled be the runtime.

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.

Note:
The size of the header (the BBArray struct) is not included.
See also:
BBARRAY_SIZE

Reimplemented in BBArrayArray, BBStringArray, BBObjectArray, BBDoubleArray, BBFloatArray, BBLongArray, BBIntArray, BBShortArray, and BBByteArray.

Referenced by bbArrayCompare(), bbArrayConcat(), bbArrayEquals(), bbArrayFromData(), bbArrayNew1D(), and bbArraySlice().