A simple vector class for long integers that allows for dynamic resizing.
More...
#include <stringBuffer.h>
|
| | Vector (void) |
| | Construct a new Vector object.
|
| | ~Vector (void) |
| | Destroy the Vector object.
|
| void | appendValue (const long) |
| | Append a value to the vector.
|
| void | appendVector (const Vector &) |
| | Append another vector to this vector.
|
| long | extractMin (VectorFP &) |
| | Extract the minimum value from a VectorFP object.
|
| void | resetVector (void) |
| | Reset the vector to an empty state.
|
| void | remove (const unsigned long) |
| | Remove a value at a specific index.
|
| void | storeValue (const long, const unsigned long) |
| | Store a value at a specific index.
|
| void | storeVector (const Vector &, const unsigned long) |
| | Store another vector at a specific index.
|
| void | sort (void) |
| | Sort the vector in place.
|
| void | swap (Vector &) |
| | Swap the contents of this vector with another.
|
| long | value (const long idx) const |
| | Get a value at a specific index.
|
| unsigned long | length (void) const |
| | Get the length of the vector.
|
|
const long * | rvalues (void) const |
|
|
static long | vDefaultLength = 16 |
|
static long | vDefaultBoost = 16 |
A simple vector class for long integers that allows for dynamic resizing.
◆ Vector()
Construct a new Vector object.
Initializes an empty vector of long values with a default initial capacity.
◆ ~Vector()
Destroy the Vector object.
Frees the memory allocated for the vector data.
◆ appendValue()
| void Vector::appendValue |
( |
const long | l | ) |
|
Append a value to the vector.
- Parameters
-
| value | The value to append. |
Appends a value to the Vector.
Adds a long value to the end of the vector, growing the vector if needed.
- Parameters
-
| l | The long value to append. |
◆ appendVector()
| void Vector::appendVector |
( |
const Vector & | v | ) |
|
Append another vector to this vector.
- Parameters
-
| other | The other vector to append. |
Appends the contents of another Vector to this Vector.
- Parameters
-
| v | The source Vector whose contents are to be appended. |
◆ extractMin()
| long Vector::extractMin |
( |
VectorFP & | values | ) |
|
Extract the minimum value from a VectorFP object.
- Parameters
-
| other | The VectorFP object to extract the minimum value from. |
- Returns
- long The minimum value.
Extracts the minimum value from the vector based on a VectorFP of floating-point values.
- Parameters
-
| values | The VectorFP of floating-point values to compare. |
- Returns
- The index of the minimum value, or -1 if the vector is empty.
◆ length()
| unsigned long Vector::length |
( |
void | | ) |
const |
|
inline |
Get the length of the vector.
- Returns
- unsigned long The length of the vector.
◆ remove()
| void Vector::remove |
( |
const unsigned long | l | ) |
|
Remove a value at a specific index.
- Parameters
-
| index | The index to remove the value at. |
Removes the element at the given index and shifts the remaining elements to fill the gap.
- Parameters
-
| l | The index of the element to remove. |
◆ resetVector()
| void Vector::resetVector |
( |
void | | ) |
|
Reset the vector to an empty state.
Resets the Vector to an empty state.
Clears the vector by resetting its length, but keeps the allocated memory.
◆ sort()
| void Vector::sort |
( |
void | | ) |
|
Sort the vector in place.
Sorts the Vector in ascending order.
◆ storeValue()
| void Vector::storeValue |
( |
const long | v, |
|
|
const unsigned long | l ) |
Store a value at a specific index.
- Parameters
-
| value | The value to store. |
| index | The index to store the value at. |
Stores a value at a specific index in the Vector.
If the index is beyond the current capacity, the vector grows to accommodate the value.
- Parameters
-
| v | The long value to store. |
| l | The index at which to store the value. |
◆ storeVector()
| void Vector::storeVector |
( |
const Vector & | v, |
|
|
const unsigned long | l ) |
Store another vector at a specific index.
- Parameters
-
| other | The other vector to store. |
| index | The index to store the vector at. |
Stores a pointer to a Vector at a specified index, growing the vector if necessary.
- Parameters
-
| v | The Vector object to store. |
| l | The index at which to store the vector. |
◆ swap()
| void Vector::swap |
( |
Vector & | src | ) |
|
Swap the contents of this vector with another.
- Parameters
-
| other | The other vector to swap with. |
Swaps the contents of this Vector with another Vector.
Exchanges the data, length, and capacity of two Vector objects.
- Parameters
-
| src | The Vector object to swap with. |
◆ value()
| long Vector::value |
( |
const long | idx | ) |
const |
Get a value at a specific index.
- Parameters
-
| idx | The index to get the value from. |
- Returns
- long The value at the index.
Retrieves a value from the Vector at the specified index.
- Parameters
-
| idx | The index from which to retrieve the value. |
- Returns
- The value stored at the specified index.
The documentation for this class was generated from the following files: