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

Public Member Functions

 Vector (void)
 
 ~Vector (void)
 
void appendValue (const long)
 
void appendVector (const Vector &)
 
long extractMin (VectorFP &)
 
void resetVector (void)
 
void remove (const unsigned long)
 
void storeValue (const long, const unsigned long)
 
void storeVector (const Vector &, const unsigned long)
 
void sort (void)
 
void swap (Vector &)
 
long value (const long idx) const
 
unsigned long length (void) const
 

Static Public Attributes

static long vDefaultLength = 16
 
static long vDefaultBoost = 16
 

Constructor & Destructor Documentation

◆ Vector()

Vector::Vector ( void )

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

◆ ~Vector()

Vector::~Vector ( void )

Frees the memory allocated for the vector data.

Member Function Documentation

◆ appendValue()

void Vector::appendValue ( const long l)

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)

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)

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.

◆ remove()

void Vector::remove ( const unsigned long l)

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 )

Resets the Vector to an empty state.

Clears the vector by resetting its length, but keeps the allocated memory.

◆ sort()

void Vector::sort ( void )

Sorts the Vector in ascending order.

◆ storeValue()

void Vector::storeValue ( const long v,
const unsigned long l )

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 )

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)

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

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: