// Larbin // Sebastien Ailleret // 04-02-00 -> 10-12-01 #ifndef VECTOR_HH #define VECTOR_HH #include "types.h" #include template class Vector { private: /** This array contain the object */ T **tab; /** Number of object in the array */ uint pos; /** Size of the array */ uint size; public: /** Constructor */ Vector (uint size = StdVectSize); /** Destructor */ ~Vector (); /** Re-init this vector : empty it all */ void recycle (); /** add an element to this vector */ void addElement (T *elt); /** give the size of the vector */ inline uint getLength () { return pos; } /** give the array containing the objects */ inline T **getTab() { return tab; } /** get an element of this Vector */ T *operator [] (uint i); }; /** Constructor * @param size the initial capacity of the Vector */ template Vector::Vector (uint size) { this->size = size; pos = 0; tab = new T*[size]; } /** Destructor */ template Vector::~Vector () { for (uint i=0; i void Vector::recycle () { for (uint i=0; i void Vector::addElement (T *elt) { assert (pos <= size); if (pos == size) { size *= 2; T **tmp = new T*[size]; for (uint i=0; i T *Vector::operator [] (uint i) { if (i