Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends

alize::ULongVector Class Reference

#include <ULongVector.h>

Inheritance diagram for alize::ULongVector:
Inheritance graph
[legend]
Collaboration diagram for alize::ULongVector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ULongVector (unsigned long capacity=0, unsigned long size=0)
const ULongVectoroperator= (const ULongVector &)
bool operator== (const ULongVector &) const
bool operator!= (const ULongVector &) const
 ULongVector (const ULongVector &)
virtual ~ULongVector ()
unsigned long size () const
void clear ()
void setSize (unsigned long size)
ULongVectoraddValue (_type v)
void addValue (const ULongVector &vect)
_typeoperator[] (unsigned long index)
_type operator[] (unsigned long index) const
void ascendingSort () const
void removeValues (unsigned long f, unsigned long l)
_typegetArray () const
void setAllValues (unsigned long u)
virtual String getClassName () const
virtual String toString () const
void save (const FileName &f)
void load (const FileName &f)

Private Types

typedef unsigned long _type

Private Member Functions

_typecreateArray () const

Static Private Member Functions

static int compare (const void *, const void *)

Private Attributes

unsigned long _size
unsigned long _capacity
_type_array

Friends

class TestULongVector

Detailed Description

This class implements a growable array of unsigned long values.

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2003

Definition at line 78 of file ULongVector.h.


Member Typedef Documentation

typedef unsigned long alize::ULongVector::_type [private]

Definition at line 84 of file ULongVector.h.


Constructor & Destructor Documentation

ULongVector::ULongVector ( unsigned long  capacity = 0,
unsigned long  size = 0 
) [explicit]

Create a vector of type unsigned long values.

Parameters:
sizeinitial size of the array
capacitymaximum number of elements in the array
The capacity will grow automatically when the size will overtake the capacity

Definition at line 72 of file ULongVector.cpp.

References setSize().

ULongVector::ULongVector ( const ULongVector v )

Definition at line 76 of file ULongVector.cpp.

References _array, and _size.

ULongVector::~ULongVector (  ) [virtual]

Definition at line 221 of file ULongVector.cpp.

References _array.


Member Function Documentation

ULongVector & ULongVector::addValue ( _type  v )

Appends a real_t data to the end of the vector

Parameters:
vthe real_t value to add
Returns:
this vector

Definition at line 134 of file ULongVector.cpp.

References _array, _capacity, _size, createArray(), and NULL.

Referenced by addValue(), alize::ViterbiAccum::computeAndAccumulate(), and alize::FeatureFileList::getFeatureCount().

void ULongVector::addValue ( const ULongVector vect )

Appends a real_t data vector to the end of the vector

Parameters:
vectthe real_t vector to add

Definition at line 150 of file ULongVector.cpp.

References _array, _size, and addValue().

void ULongVector::ascendingSort (  ) const

Sorts the internal vector (ascending)

Definition at line 183 of file ULongVector.cpp.

References _array, _size, compare(), and NULL.

void ULongVector::clear (  )

Definition at line 204 of file ULongVector.cpp.

References _size.

Referenced by alize::ViterbiAccum::reset().

int ULongVector::compare ( const void *  s1,
const void *  s2 
) [static, private]

Definition at line 174 of file ULongVector.cpp.

Referenced by ascendingSort().

ULongVector::_type * ULongVector::createArray (  ) const [private]

Definition at line 112 of file ULongVector.cpp.

References _capacity, and alize::Object::assertMemoryIsAllocated().

Referenced by addValue(), operator=(), and setSize().

ULongVector::_type * ULongVector::getArray (  ) const

Use this method to access directly to the internal vector

Returns:
a pointer on the first element
Warning:
Fast but dangerous ! Use preferably operator [].

Definition at line 202 of file ULongVector.cpp.

References _array.

Referenced by alize::Feature::copySelectedData().

String ULongVector::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Definition at line 208 of file ULongVector.cpp.

void ULongVector::load ( const FileName f )
bool ULongVector::operator!= ( const ULongVector v ) const

Definition at line 109 of file ULongVector.cpp.

const ULongVector & ULongVector::operator= ( const ULongVector v )

Definition at line 81 of file ULongVector.cpp.

References _array, _capacity, _size, createArray(), alize::Object::isSameObject(), and NULL.

bool ULongVector::operator== ( const ULongVector v ) const

Definition at line 97 of file ULongVector.cpp.

References _array, and _size.

ULongVector::_type ULongVector::operator[] ( unsigned long  index ) const

like the other operator[] but for constant ULongVector object.

Definition at line 127 of file ULongVector.cpp.

References _array, _size, alize::Object::assertIsInBounds(), and NULL.

ULongVector::_type & ULongVector::operator[] ( unsigned long  index )

Overloaded operator[] to access an element in the vector.

Parameters:
indexindex of the element to access
Returns:
a reference to the element
Exceptions:
IndexOutOfBoundsException

Definition at line 120 of file ULongVector.cpp.

References _array, _size, alize::Object::assertIsInBounds(), and NULL.

void ULongVector::removeValues ( unsigned long  f,
unsigned long  l 
)

Removes a set of values from the array.

Parameters:
findex of the first value to remove
lindex of the last value to remove

Definition at line 189 of file ULongVector.cpp.

References _array, _size, and NULL.

void ULongVector::save ( const FileName f )

Definition at line 228 of file ULongVector.cpp.

References _array, _size, alize::String::c_str(), and alize::Exception::toString().

void ULongVector::setAllValues ( unsigned long  u )

Sets all the values to a a particular value

Parameters:
Uthe unsigned long value to set

Definition at line 223 of file ULongVector.cpp.

References _array, and _size.

void ULongVector::setSize ( unsigned long  size )

Set a new size

Parameters:
sizenew size

Definition at line 157 of file ULongVector.cpp.

References _array, _capacity, _size, createArray(), NULL, and size().

Referenced by alize::ViterbiAccum::getPath(), and ULongVector().

unsigned long ULongVector::size (  ) const

Definition at line 206 of file ULongVector.cpp.

References _size.

Referenced by alize::Feature::copySelectedData(), and setSize().

String ULongVector::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Definition at line 210 of file ULongVector.cpp.

References _array, _size, and alize::String::valueOf().


Friends And Related Function Documentation

friend class TestULongVector [friend]

Definition at line 80 of file ULongVector.h.


Member Data Documentation

unsigned long alize::ULongVector::_capacity [private]

Definition at line 162 of file ULongVector.h.

Referenced by addValue(), createArray(), load(), operator=(), and setSize().

unsigned long alize::ULongVector::_size [private]

The documentation for this class was generated from the following files: