seal::Map< IndexType, DataType > Class Template Reference

#include <map.h>

Inheritance diagram for seal::Map< IndexType, DataType >:

seal::Collection< DataType >

List of all members.

Public Member Functions

 Map ()
 Map (const Map< IndexType, DataType > &map)
virtual ~Map ()
virtual unsigned int size (void) const
virtual bool isEmpty (void) const
virtual AbstractIterator
< DataType > * 
iteratorPtr (void) const
Map< IndexType, DataType >
::Iterator 
iterator (void) const
virtual void purge (void)
DataType & operator[] (const IndexType &index)
const DataType & operator[] (const IndexType &index) const
void remove (const IndexType &index)
bool hasIndex (const IndexType &index) const
virtual DataType & first (void) throw (EmptyCollectionException)
virtual const DataType & first (void) const throw (EmptyCollectionException)
virtual DataType & last (void) throw (EmptyCollectionException)
virtual const DataType & last (void) const throw (EmptyCollectionException)
void operator= (const Map< IndexType, DataType > &map)

Classes

class  Iterator


Detailed Description

template<typename IndexType, typename DataType>
class seal::Map< IndexType, DataType >

This template class encapsulates a map data structure. Note that it is not a HashMap. The template parameter IndexType specifies the type of the index, and the template parameter DataType specifies the data type of the elements stored in the map.

Constructor & Destructor Documentation

template<typename IndexType, typename DataType>
seal::Map< IndexType, DataType >::Map ( void   )  [inline]

Constructor. Creates an empty map.

template<typename IndexType, typename DataType>
seal::Map< IndexType, DataType >::Map ( const Map< IndexType, DataType > &  map  )  [inline]

Copy constructor. This is only a reference copier. The old and the new map objects will share the same data.

template<typename IndexType, typename DataType>
seal::Map< IndexType, DataType >::~Map ( void   )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename IndexType, typename DataType>
virtual unsigned int seal::Map< IndexType, DataType >::size ( void   )  const [inline, virtual]

Returns the size, which is equal to the number of elements in the map.

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
virtual bool seal::Map< IndexType, DataType >::isEmpty ( void   )  const [inline, virtual]

Returns true of the map is empty; False otherwise.

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
virtual AbstractIterator<DataType>* seal::Map< IndexType, DataType >::iteratorPtr ( void   )  const [inline, virtual]

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

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
Map<IndexType, DataType>::Iterator seal::Map< IndexType, DataType >::iterator ( void   )  const [inline]

Returns an iterator of the map.

template<typename IndexType, typename DataType>
void seal::Map< IndexType, DataType >::purge ( void   )  [inline, virtual]

Destroys all the elements in the map. The size of the map will be zero after a call to this function.

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
DataType & seal::Map< IndexType, DataType >::operator[] ( const IndexType &  index  )  [inline]

Returns a reference the element stored at the specified index. If an element with the specified index is not present, then it is created.

Parameters:
index The element with this index is returned by the function.

template<typename IndexType, typename DataType>
const DataType & seal::Map< IndexType, DataType >::operator[] ( const IndexType &  index  )  const [inline]

Returns a constant reference the element stored at the specified index. If an element with the specified index is not present, then it is created.

Parameters:
index The element with this index is returned by the function.

template<typename IndexType, typename DataType>
void seal::Map< IndexType, DataType >::remove ( const IndexType &  index  )  [inline]

Removes the element with the specified index from the map.

Parameters:
index The index of the element which has to be removed from the map.

template<typename IndexType, typename DataType>
bool seal::Map< IndexType, DataType >::hasIndex ( const IndexType &  index  )  const [inline]

Returns true if the specified index is present in the map; False otherwise.

Parameters:
index The function checks if this index value is used for any element of the map.

template<typename IndexType, typename DataType>
const DataType & seal::Map< IndexType, DataType >::first ( void   )  throw (EmptyCollectionException) [inline, virtual]

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

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
virtual const DataType& seal::Map< IndexType, DataType >::first ( void   )  const throw (EmptyCollectionException) [virtual]

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

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
const DataType & seal::Map< IndexType, DataType >::last ( void   )  throw (EmptyCollectionException) [inline, virtual]

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

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
virtual const DataType& seal::Map< IndexType, DataType >::last ( void   )  const throw (EmptyCollectionException) [virtual]

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

Implements seal::Collection< DataType >.

template<typename IndexType, typename DataType>
void seal::Map< IndexType, DataType >::operator= ( const Map< IndexType, DataType > &  map  )  [inline]

Assignment operator. The LHS and the RHS objects will share the data of the RHS object after the assignment.


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

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