#include <map.h>
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 |
IndexType
specifies the type of the index, and the template parameter DataType
specifies the data type of the elements stored in the map. seal::Map< IndexType, DataType >::Map | ( | void | ) | [inline] |
Constructor. Creates an empty map.
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.
seal::Map< IndexType, DataType >::~Map | ( | void | ) | [inline, virtual] |
Destructor.
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 >.
virtual bool seal::Map< IndexType, DataType >::isEmpty | ( | void | ) | const [inline, virtual] |
Returns true of the map is empty; False otherwise.
Implements seal::Collection< 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 >.
Map<IndexType, DataType>::Iterator seal::Map< IndexType, DataType >::iterator | ( | void | ) | const [inline] |
Returns an iterator of the map.
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 >.
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.
index | The element with this index is returned by the function. |
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.
index | The element with this index is returned by the function. |
void seal::Map< IndexType, DataType >::remove | ( | const IndexType & | index | ) | [inline] |
Removes the element with the specified index from the map.
index | The index of the element which has to be removed from the map. |
bool seal::Map< IndexType, DataType >::hasIndex | ( | const IndexType & | index | ) | const [inline] |
Returns true if the specified index is present in the map; False otherwise.
index | The function checks if this index value is used for any element of the map. |
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 >.
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 >.
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 >.
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 >.
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.