Dynamic array of valueType. More...
#include <MeshViz/misc/PbArray.h>
Public Member Functions | |
className () | |
className (int init_size, int extend=10) | |
className (const className &other_array) | |
~className () | |
const valueType * | get () const |
valueType | get (int index) const |
int | find (valueType val) const |
void | set (int index, valueType val) |
int | add (valueType val) |
int | add (int num_val, const valueType *val) |
className & | operator= (const className &other_array) |
className & | operator= (const std::vector< valueType > &other_array) |
void | operator+= (const className &other_array) |
void | operator+= (valueType val) |
valueType & | operator[] (int index) |
const valueType & | operator[] (int index) const |
void | setCapacity (int capacity, int extend) |
void | squeeze () |
int | getCapacity () const |
int | getNum () const |
void | increasingSort () |
void | decreasingSort () |
void | empty () |
Friends | |
int | operator== (const className &array_1, const className &array_2) |
int | operator!= (const className &array_1, const className &array_2) |
Provides methods and operators for insertion and retrieval of valueType values. It automatically resizes itself when necessary.
className::className | ( | ) | [inline] |
className::className | ( | int | init_size, | |
int | extend = 10 | |||
) |
When the array resizes itself, the extension is a multiple of extend.
className::className | ( | const className & | other_array | ) |
className::~className | ( | ) |
int className::add | ( | int | num_val, | |
const valueType * | val | |||
) |
Inserts a list of valueType values at the end of the array.
Returns the location of the last one inserted.
int className::add | ( | valueType | val | ) | [inline] |
Inserts valueType value at the end of the array.
Returns its location in the array.
void className::decreasingSort | ( | ) |
Sorts array by decreasing order.
void className::empty | ( | ) | [inline] |
After empty, the array appears like no valueType value has been previously inserted.
int className::find | ( | valueType | val | ) | const [inline] |
Finds the first index in the array of a given valueType value (-1 if not found).
valueType className::get | ( | int | index | ) | const [inline] |
Gets the valueType value at a particular index.
const valueType * className::get | ( | ) | const [inline] |
Gets the adress of the internal array.
int className::getCapacity | ( | ) | const [inline] |
Gets the allocated size of the array.
int className::getNum | ( | ) | const [inline] |
Gets the number of values in the array.
void className::increasingSort | ( | ) |
Sorts array by increasing order.
void className::operator+= | ( | valueType | val | ) | [inline] |
Adds val at the end of the array.
void className::operator+= | ( | const className & | other_array | ) |
Appends other_array to the end of the array.
className& className::operator= | ( | const std::vector< valueType > & | other_array | ) |
Copy from an STL vector.
const valueType & className::operator[] | ( | int | index | ) | const [inline] |
valueType & className::operator[] | ( | int | index | ) | [inline] |
void className::set | ( | int | index, | |
valueType | val | |||
) | [inline] |
Inserts valueType value at a specified position in the array.
void className::setCapacity | ( | int | capacity, | |
int | extend | |||
) |
set the capacity and allocate this capacity if necessary
void className::squeeze | ( | ) |
Inequality comparison operator.
Equality comparison operator.