pgMap< K, D > Class Template Reference
[pgGen -- General purpose module]

A sorted associative containers that contain unique key/value pairs. More...

#include <pg_map.h>

List of all members.

Classes

struct  MapItem

Public Member Functions

 pgDefineException (ExceptionInvalidArgument)
 pgDefineException (ExceptionNotFound)
 pgDefineException (ExceptionNotInitialized)
 pgDefineException (ExceptionSameKeyExists)
 pgMap ()
 Constructs a pgMap.
 ~pgMap ()
 Destructs this pgMap.
void init (u16 hash_size)
 Initializes this pgMap whose hash list has the specified size.
u16 getHashSize () const
 Returns the size of the hash list of this pgMap.
u16 getDataNum () const
 Returns the number of the key/value pairs in this pgMap.
D * get (K key)
 Returns the value which is associated with the specified key.
D * getN (K key)
 Returns the value which is associated with the specified key.
void add (K key, const D &data)
 Adds a key/value pair to this pgMap.
void remove (K key)
 Removes the specified key/value pair from this pgMap.
void clear ()
 Removes all key/value pairs from this pgMap.
const K * getFirstKeyN () const
 Returns the first key in this pgMap.
const K * getLastKeyN () const
 Returns the last key in this pgMap.
const K * getPrevKeyN (K key)
 Returns the previous key of the specified key.
const K * getNextKeyN (K key)
 Returns the next key of the specified key.
void moveFirst (K key)
 Move the specified key/value pair to the first in this pgMap.
void moveLast (K key)
 Move the specified key/value pair to the last in this pgMap.
void moveBefore (K key, K next_key)
 Move the specified key/value pair before the another pair.
void moveAfter (K key, K prev_key)
 Move the specified key/value pair after the another pair.


Detailed Description

template<class K, class D>
class pgMap< K, D >

A sorted associative containers that contain unique key/value pairs.

Template Parameters:
K The key type which is used to find the associated value.
D The value type which is associated with the key type.

Member Function Documentation

template<class K, class D>
void pgMap< K, D >::add ( key,
const D &  data 
) [inline]

Adds a key/value pair to this pgMap.

Parameters:
[in] key A key.
[in] data A value.

template<class K, class D>
D* pgMap< K, D >::get ( key  )  [inline]

Returns the value which is associated with the specified key.

Parameters:
[in] key A key in this pgMap.
Returns:
The value which is associated with the specified key.

template<class K, class D>
u16 pgMap< K, D >::getDataNum (  )  const [inline]

Returns the number of the key/value pairs in this pgMap.

Returns:
The number of the key/value pairs in this pgMap.

template<class K, class D>
const K* pgMap< K, D >::getFirstKeyN (  )  const [inline]

Returns the first key in this pgMap.

If the pgMap has no key/value pair, returns NULL.

Returns:
The first key in this pgMap.

template<class K, class D>
u16 pgMap< K, D >::getHashSize (  )  const [inline]

Returns the size of the hash list of this pgMap.

Returns:
The size of the hash list of this pgMap.

template<class K, class D>
const K* pgMap< K, D >::getLastKeyN (  )  const [inline]

Returns the last key in this pgMap.

If the pgMap has no key/value pair, returns NULL.

Returns:
The last key in this pgMap.

template<class K, class D>
D* pgMap< K, D >::getN ( key  )  [inline]

Returns the value which is associated with the specified key.

If the specified key isn't in this pgMap, returns NULL.

Parameters:
[in] key A key in this pgMap.
Returns:
The value which is associated with the specified key.

template<class K, class D>
const K* pgMap< K, D >::getNextKeyN ( key  )  [inline]

Returns the next key of the specified key.

If the specified key has no next key, returns NULL.

Parameters:
[in] key A key in this pgMap.
Returns:
The next key of the specified key.

template<class K, class D>
const K* pgMap< K, D >::getPrevKeyN ( key  )  [inline]

Returns the previous key of the specified key.

If the specified key has no previous key, returns NULL.

Parameters:
[in] key A key in this pgMap.
Returns:
The previous key of the specified key.

template<class K, class D>
void pgMap< K, D >::init ( u16  hash_size  )  [inline]

Initializes this pgMap whose hash list has the specified size.

The size of the hash list must be more than zero.

Parameters:
[in] hash_size The size of the hash list of this pgMap.

template<class K, class D>
void pgMap< K, D >::moveAfter ( key,
prev_key 
) [inline]

Move the specified key/value pair after the another pair.

Parameters:
[in] key A key in this pgMap.
[in] prev_key An another key in this pgMap.

template<class K, class D>
void pgMap< K, D >::moveBefore ( key,
next_key 
) [inline]

Move the specified key/value pair before the another pair.

Parameters:
[in] key A key in this pgMap.
[in] next_key An another key in this pgMap.

template<class K, class D>
void pgMap< K, D >::moveFirst ( key  )  [inline]

Move the specified key/value pair to the first in this pgMap.

Parameters:
[in] key A key in this pgMap.

template<class K, class D>
void pgMap< K, D >::moveLast ( key  )  [inline]

Move the specified key/value pair to the last in this pgMap.

Parameters:
[in] key A key in this pgMap.

template<class K, class D>
void pgMap< K, D >::remove ( key  )  [inline]

Removes the specified key/value pair from this pgMap.

Parameters:
[in] key A key in this pgMap.


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

Generated on Sat Aug 15 11:24:38 2009 for Pogolyn by  doxygen 1.5.8