PUMA Library Reference Manual
|
#include <Array.h>
Variable length array implementation specialized for pointer types.
Grows with an increasing increment.
Item | The array item type. Needs to be a pointer type. |
Public Member Functions | |
Array (long is=default_init_size, long incr=default_increment) | |
Constructor. | |
Array (const Array< Item * > &array) | |
Copy-constructor. | |
~Array () | |
Destructor. | |
Array< Item * > & | operator= (const Array< Item * > &array) |
Assignment operator. | |
void | append (const Item *item) |
Append an item to the array. | |
void | insert (long idx, const Item *item) |
Insert an item at the given array index. | |
void | prepend (const Item *item) |
Prepend an item. | |
void | remove (long idx) |
Remove the array item at the given array index. | |
void | reset () |
Reset the array. | |
Item *& | get (long idx) |
Get a reference to the array item at the given array index. | |
Item *& | operator[] (long idx) |
Get a reference to the array item at the given array index. | |
Item * | fetch (long idx) const |
Get the array item at the given array index. | |
Item *& | lookup (long idx) const |
Get a reference to the array item at the given array index. | |
long | length () const |
Get the number of items in the array. | |
|
inline |
Constructor.
is | The default size of the array. |
incr | The default increment value. |
|
inline |
Copy-constructor.
array | The array to copy. |
|
inline |
Destructor.
Destroys the array.
|
inline |
Append an item to the array.
item | The item to append. |
|
inline |
Get the array item at the given array index.
idx | The array index. |
|
inline |
Get a reference to the array item at the given array index.
If the index exceeds the array bounds, then the array is reallocated accordingly.
idx | The array index. |
|
inline |
Insert an item at the given array index.
idx | The array index. |
item | The item to insert. |
|
inline |
Get the number of items in the array.
|
inline |
Get a reference to the array item at the given array index.
idx | The array index. |
|
inline |
Assignment operator.
array | The array to copy. |
|
inline |
Get a reference to the array item at the given array index.
If the index exceeds the array bounds, then the array is reallocated accordingly.
idx | The array index. |
|
inline |
Prepend an item.
item | The item to prepend. |
|
inline |
Remove the array item at the given array index.
idx | The array index. |
|
inline |
Reset the array.
Destroys the current array.