Rudiments
|
Inherits arraycollection< valuetype >.
Public Member Functions | |
staticarray () | |
staticarray (staticarray< valuetype, count > &v) | |
staticarray (arraycollection< valuetype > &v) | |
staticarray< valuetype, count > & | operator= (staticarray< valuetype, count > &v) |
staticarray< valuetype, count > & | operator= (arraycollection< valuetype > &v) |
~staticarray () | |
valuetype & | operator[] (uint64_t index) |
uint64_t | getCount () |
bool | clear () |
Public Member Functions inherited from arraycollection< valuetype > | |
virtual const char * | getType () |
virtual ssize_t | write () |
virtual ssize_t | write (output *out) |
virtual ssize_t | writeJson () |
virtual ssize_t | writeJson (bool indent) |
virtual ssize_t | writeJson (output *out) |
virtual ssize_t | writeJson (output *out, bool indent) |
Public Member Functions inherited from collection | |
collection () | |
collection (collection &c) | |
collection & | operator= (collection &c) |
virtual | ~collection () |
comparator * | getComparator () |
void | setComparator (comparator *newcomp) |
virtual bool | isReadOnly () |
virtual bool | isBlockBased () |
virtual uint64_t | getBlockSize () |
virtual bool | isSequentialAccess () |
virtual void | setManageValues (bool manage) |
virtual bool | getManageValues () |
virtual void | setManageArrayValues (bool manage) |
virtual bool | getManageArrayValues () |
virtual void | setManageKeys (bool manage) |
virtual bool | getManageKeys () |
virtual void | setManageArrayKeys (bool manage) |
virtual bool | getManageArrayKeys () |
Public Member Functions inherited from object | |
virtual | ~object () |
The staticarray class allows you to store a pre-defined number of values and access them with array-like syntax.
"valuetype" can be any scalar type, including a pointer, but cannot be an array.
Ie. these are legal: staticarray<int,10> d; staticarray<myclass,10> d; staticarray<myclass *,10> d;
These are not legal and whether they work or even compile would be platform-dependent: staticarray<int[100],10> d; staticarray<myclass[100],10> d; staticarray<myclass *[100],10> d;
However, it is possible to create an array of arrays by nesting staticarrays or dynamicarrays, like:
staticarray<staticarray<in >,10> d; staticarray<staticarray<myclass>,10> d; staticarray<staticarray<myclass *>,10> d; staticarray<dynamicarray<int>,10> d; staticarray<dynamicarray<myclass>,10> d; staticarray<dynamicarray<myclass *>,10> d;
NOTE: If "valuetype" is a pointer and either of collection::setManageValues(true) or collection::setManageArrayValue(true) are called, then all elements of the staticarray must be set to something.
For example, if the staticarray has count 10 then elements 0-9 must be set to some value. They may be set to 0 or NULL, but they must be set.
Otherwise attempts to delete the uninitialized elements during calls to clear() or the destructor will likely cause the program to crash.
|
inline |
Creates an empty instance of the staticarray class with "count" elements. "count" is given in the template definition.
|
inline |
Creates an instance of the staticarray class that is a copy of "v".
|
inline |
Creates an instance of the staticarray class that is a copy of "v".
|
inline |
Deletes this instance of the staticarray class.
|
inlinevirtual |
Clears the array. Always returns true.
Implements collection.
|
inlinevirtual |
Returns the number of elements in the array.
Implements collection.
|
inline |
Makes this instance of the staticarray class identical to "v".
|
inline |
Makes this instance of the staticarray class identical to "v".
|
inlinevirtual |
Provides read/write access to the "index"th element of the staticarray.
Implements arraycollection< valuetype >.