seal::Vector< T > Class Template Reference

#include <vector.h>

Inheritance diagram for seal::Vector< T >:

seal::List< T > seal::RandomAccess< T > seal::Collection< T > seal::TextFile

List of all members.

Public Member Functions

 Vector (void)
 Vector (unsigned int length)
 Vector (const Vector< T > &v)
virtual ~Vector ()
virtual unsigned int size (void) const
virtual bool isEmpty (void) const
virtual AbstractIterator< T > * iteratorPtr (void) const
Vector< T >::Iterator iterator (void) const
virtual void purge (void)
virtual const T & operator[] (int index) const throw (OutOfRangeException<int>)
virtual T & operator[] (int index) throw (OutOfRangeException<int>)
void operator= (const Vector< T > &v)
virtual void pushBack (const T element)
virtual void popBack (void)
virtual void pushFront (const T element)
virtual void popFront (void)
virtual void insert (const T element, unsigned int index)
virtual void remove (unsigned int index)
virtual const T & first (void) const throw (EmptyCollectionException)
virtual const T & last (void) const throw (EmptyCollectionException)
virtual T & first (void) throw (EmptyCollectionException)
virtual T & last (void) throw (EmptyCollectionException)

Classes

class  Iterator


Detailed Description

template<typename T>
class seal::Vector< T >

This class encapsulates a vector data structure. A vector data type provides constant time access to its elements like a simple 1-dimensional array while having the ability to resize itself dynamically (at run time). Specifically, the vector data structure supports pushing and popping at both ends, insertion and deletion of elements at any index, and random constant-time access operator [] like a conventional array. Hence, a vector data type is both an array as well as a list. In order to encapsulate its dual nature, the class Vector in the SEAL library is derived from the abstract classes List and RandomAccess.

Constructor & Destructor Documentation

template<typename T>
seal::Vector< T >::Vector ( void   )  [inline]

Default Constructor. It initialises a vector of size zero. Size of a vector is the number of elements in the vector.

template<typename T>
seal::Vector< T >::Vector ( unsigned int  length  )  [inline]

This constructor initialises a vector with the specified size.

template<typename T>
seal::Vector< T >::Vector ( const Vector< T > &  v  )  [inline]

Copy constructor. It is only a reference copier. The new and the old vector objects share the same data elements.

template<typename T>
seal::Vector< T >::~Vector (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename T>
virtual unsigned int seal::Vector< T >::size ( void   )  const [inline, virtual]

Returns the current size of the vector. Size of a vector is the number of elements in the vector.

Implements seal::Collection< T >.

template<typename T>
virtual bool seal::Vector< T >::isEmpty ( void   )  const [inline, virtual]

Returns true if the vector is empty (ie., if the size of the vector is zero).

Implements seal::Collection< T >.

template<typename T>
virtual AbstractIterator<T>* seal::Vector< T >::iteratorPtr ( void   )  const [inline, virtual]

Returns a pointer to an iterator object of the vector. The client of this function should be responsible to delete the returned iterator object using delete.

Implements seal::Collection< T >.

template<typename T>
Vector<T>::Iterator seal::Vector< T >::iterator ( void   )  const [inline]

Returns an iterator object corresponding to the vector.

template<typename T>
void seal::Vector< T >::purge ( void   )  [inline, virtual]

Deletes all the elements of the vector. The size of the vector will be zero after a call to this function.

Implements seal::Collection< T >.

template<typename T>
const T & seal::Vector< T >::operator[] ( int  index  )  const throw (OutOfRangeException<int>) [inline, virtual]

The random-access array like constant time operator.

Implements seal::RandomAccess< T >.

template<typename T>
T & seal::Vector< T >::operator[] ( int  index  )  throw (OutOfRangeException<int>) [inline, virtual]

The random-access array like constant time operator.

Implements seal::RandomAccess< T >.

template<typename T>
void seal::Vector< T >::operator= ( const Vector< T > &  v  )  [inline]

Assignment operator. It is only a reference copier. That is, after the assignment, the LHS and RHS will share the same data elements.

template<typename T>
void seal::Vector< T >::pushBack ( const T  element  )  [inline, virtual]

Appends an element at the back end of the vector.

Parameters:
element The element to be appended to the vector.

Implements seal::List< T >.

template<typename T>
void seal::Vector< T >::popBack ( void   )  [inline, virtual]

Pops an element from the back end of the list.

Implements seal::List< T >.

template<typename T>
void seal::Vector< T >::pushFront ( const T  element  )  [inline, virtual]

Appends an element at the front end of the vector.

Parameters:
element The element to be appended to the vector.

Implements seal::List< T >.

template<typename T>
void seal::Vector< T >::popFront ( void   )  [inline, virtual]

Pops an element from the front end of the vector.

Implements seal::List< T >.

template<typename T>
void seal::Vector< T >::insert ( const T  element,
unsigned int  index 
) [inline, virtual]

Inserts an element, at the specified index, in to the vector. If the specified index is greater than or equal to the size of the vector, then the element is appended to the back end of the vector.

Parameters:
element The element to be inserted.
index The index at which the element should be inserted.

Implements seal::List< T >.

template<typename T>
void seal::Vector< T >::remove ( unsigned int  index  )  [inline, virtual]

Removes the element at the specified index in the vector. If the specified index is greater than or equal to the size of the vector, then nothing is done.

Parameters:
index The element at this index will be removed from the vector.

Implements seal::List< T >.

template<typename T>
const T & seal::Vector< T >::first ( void   )  const throw (EmptyCollectionException) [inline, virtual]

Returns a reference to the first element in the vector. Throws an seal::EmptyCollectionException if the vector is empty.

Implements seal::Collection< T >.

template<typename T>
const T & seal::Vector< T >::last ( void   )  const throw (EmptyCollectionException) [inline, virtual]

Returns a reference to the last element in the vector. Throws an seal::EmptyCollectionException if the vector is empty.

Implements seal::Collection< T >.

template<typename T>
T & seal::Vector< T >::first ( void   )  throw (EmptyCollectionException) [inline, virtual]

Returns a reference to the first element in the vector. Throws an seal::EmptyCollectionException if the vector is empty.

Implements seal::Collection< T >.

template<typename T>
T & seal::Vector< T >::last ( void   )  throw (EmptyCollectionException) [inline, virtual]

Returns a reference to the last element in the vector. Throws an seal::EmptyCollectionException if the vector is empty.

Implements seal::Collection< T >.


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

Generated on Sat May 16 21:35:21 2009 for SEAL by  doxygen 1.5.5