cawlign 0.0.1
Codon-aware pairwise sequence alignment
Loading...
Searching...
No Matches
Vector Class Reference

A simple vector class for long integers that allows for dynamic resizing. More...

#include <stringBuffer.h>

Public Member Functions

 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 Public Attributes

static long vDefaultLength = 16
static long vDefaultBoost = 16

Detailed Description

A simple vector class for long integers that allows for dynamic resizing.

Constructor & Destructor Documentation

◆ Vector()

Vector::Vector ( void )

Construct a new Vector object.

Initializes an empty vector of long values with a default initial capacity.

◆ ~Vector()

Vector::~Vector ( void )

Destroy the Vector object.

Frees the memory allocated for the vector data.

Member Function Documentation

◆ appendValue()

void Vector::appendValue ( const long l)

Append a value to the vector.

Parameters
valueThe 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
lThe long value to append.

◆ appendVector()

void Vector::appendVector ( const Vector & v)

Append another vector to this vector.

Parameters
otherThe other vector to append.

Appends the contents of another Vector to this Vector.

Parameters
vThe source Vector whose contents are to be appended.

◆ extractMin()

long Vector::extractMin ( VectorFP & values)

Extract the minimum value from a VectorFP object.

Parameters
otherThe 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
valuesThe 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
indexThe index to remove the value at.

Removes the element at the given index and shifts the remaining elements to fill the gap.

Parameters
lThe 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
valueThe value to store.
indexThe 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
vThe long value to store.
lThe 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
otherThe other vector to store.
indexThe index to store the vector at.

Stores a pointer to a Vector at a specified index, growing the vector if necessary.

Parameters
vThe Vector object to store.
lThe index at which to store the vector.

◆ swap()

void Vector::swap ( Vector & src)

Swap the contents of this vector with another.

Parameters
otherThe 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
srcThe Vector object to swap with.

◆ value()

long Vector::value ( const long idx) const

Get a value at a specific index.

Parameters
idxThe index to get the value from.
Returns
long The value at the index.

Retrieves a value from the Vector at the specified index.

Parameters
idxThe 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: