Classes | Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

alize::LKVector Class Reference

#include <LKVector.h>

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

List of all members.

Classes

struct  type

Public Member Functions

 LKVector (unsigned long capacity=0, unsigned long size=0)
virtual ~LKVector ()
const LKVectoroperator= (const LKVector &)
 LKVector (const LKVector &)
unsigned long size () const
void clear ()
void setSize (unsigned long size)
void pack (unsigned long size)
void addValue (type v)
typeoperator[] (unsigned long index)
const typeoperator[] (unsigned long index) const
void descendingSort () const
typegetArray () const
virtual String getClassName () const
virtual String toString () const

Public Attributes

real_t sumNonTopDistribWeights
real_t sumNonTopDistribLK
unsigned long topDistribsCount

Private Member Functions

typecreateArray () const
bool operator== (const LKVector &) const
bool operator!= (const LKVector &) const

Static Private Member Functions

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

Private Attributes

unsigned long _capacity
unsigned long _size
type_array

Detailed Description

This class implements a growable array of a special type values Used for determine top distributions

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

Definition at line 78 of file LKVector.h.


Constructor & Destructor Documentation

LKVector::LKVector ( unsigned long  capacity = 0,
unsigned long  size = 0 
)

Create a vector of type type 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 69 of file LKVector.cpp.

References setSize().

LKVector::~LKVector (  ) [virtual]

Definition at line 210 of file LKVector.cpp.

References _array.

LKVector::LKVector ( const LKVector obj )

Member Function Documentation

void LKVector::addValue ( type  v )

Appends a real_t data to the end of the vector

Parameters:
vthe real_t value to add

Definition at line 128 of file LKVector.cpp.

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

Referenced by LKVector(), and operator=().

void LKVector::clear (  )

Definition at line 192 of file LKVector.cpp.

References _size.

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

Definition at line 175 of file LKVector.cpp.

Referenced by descendingSort().

LKVector::type * LKVector::createArray (  ) const [private]

Definition at line 106 of file LKVector.cpp.

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

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

void LKVector::descendingSort (  ) const

Sorts the internal vector

Definition at line 184 of file LKVector.cpp.

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

LKVector::type * LKVector::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 190 of file LKVector.cpp.

References _array.

String LKVector::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 196 of file LKVector.cpp.

bool alize::LKVector::operator!= ( const LKVector  ) const [private]
const LKVector & LKVector::operator= ( const LKVector obj )
bool alize::LKVector::operator== ( const LKVector  ) const [private]
const LKVector::type & LKVector::operator[] ( unsigned long  index ) const

Definition at line 121 of file LKVector.cpp.

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

LKVector::type & LKVector::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 114 of file LKVector.cpp.

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

void LKVector::pack ( unsigned long  size )

modify the capacity of the array

Parameters:
sizenew size

Definition at line 143 of file LKVector.cpp.

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

void LKVector::setSize ( unsigned long  size )

Set a new size

Parameters:
sizenew size

Definition at line 158 of file LKVector.cpp.

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

Referenced by LKVector().

unsigned long LKVector::size (  ) const

Definition at line 194 of file LKVector.cpp.

References _size.

Referenced by pack(), and setSize().

String LKVector::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 198 of file LKVector.cpp.

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


Member Data Documentation

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

Definition at line 153 of file LKVector.h.

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

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

Definition at line 148 of file LKVector.h.

Referenced by LKVector(), and operator=().

Definition at line 147 of file LKVector.h.

Referenced by LKVector(), and operator=().

Definition at line 149 of file LKVector.h.

Referenced by LKVector(), and operator=().


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