Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBmap Class Template Reference

Associative container for key-value maps. **. More...

#include "CTBmap.hxx"

Inheritance diagram for CTBmap:

Inheritance graph
[legend]
Collaboration diagram for CTBmap:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CTBmap< K, V, CMap
typedef CTBmapNode< K, V, CNode
typedef CTBmapIterator< K,
V, C
Iterator
typedef CTBmapBrowser< K,
V, C
Browser

Public Methods

 CTBmap ()
 CTBmap (const CTBmap< K, V, C > &rhs)
 ~CTBmap ()
bool Insert (const CTBpair< const K, V > &pair)
bool Insert (const K &key, const V &value)
bool Insert (const K &key)
CTBmapIterator< K, V, CFind (const K &key)
CTBmapBrowser< K, V, CFind (const K &key) const
CTBmapIterator< K, V, CFindLessEqual (const K &key, bool &b_found)
CTBmapBrowser< K, V, CFindLessEqual (const K &key, bool &b_found) const
CTBmapIterator< K, V, CFindGreaterEqual (const K &key, bool &b_found)
CTBmapBrowser< K, V, CFindGreaterEqual (const K &key, bool &b_found) const
CTBmapIterator< K, V, CFindOrCreate (const K &key, bool &b_found)
bool Rename (const K &keyold, const K &keynew)
bool Rename (const CTBmapIterator< K, V, C > &p, const K &keynew)
bool Delete (const K &key)
bool Delete (const CTBmapIterator< K, V, C > &p)
void Clear ()
CTBmapIterator< K, V, CFirst ()
CTBmapBrowser< K, V, CFirst () const
CTBmapIterator< K, V, CLast ()
CTBmapBrowser< K, V, CLast () const
CTBint Size () const
void Dump (int i_indent=0, ostream &os=cout, const char *p_text=0) const
Voperator[] (const K &key)
CTBmap< K, V, C > & operator= (const CTBmap< K, V, C > &rhs)
 operator bool () const

Private Methods

CTBmapNode< K, V, C > * LocateMatchOrBound (const K &key, int &i_mtype) const
CTBmapNode< K, V, C > * LocateMatchOrPrev (const K &key, bool &b_found) const
CTBmapNode< K, V, C > * LocateMatchOrNext (const K &key, bool &b_found) const
void InsertNode (CTBmapNode< K, V, C > *p_node, CTBmapNode< K, V, C > *p_parent, int i_ctype)
void RemoveNode (CTBmapNode< K, V, C > *p_node)

Detailed Description

template<class K, class V, class C>
class CTBmap< K, V, C >

Associative container for key-value maps. **.

Definition at line 27 of file CTBmap.hxx.


Member Typedef Documentation

template<class K, class V, class C>
typedef CTBmap<K,V,C> CTBmap::Map
 

Definition at line 30 of file CTBmap.hxx.

template<class K, class V, class C>
typedef CTBmapNode<K,V,C> CTBmap::Node
 

Definition at line 31 of file CTBmap.hxx.

Referenced by FindOrCreate(), and Insert().

template<class K, class V, class C>
typedef CTBmapIterator<K,V,C> CTBmap::Iterator
 

Definition at line 32 of file CTBmap.hxx.

Referenced by Find(), FindGreaterEqual(), FindLessEqual(), FindOrCreate(), First(), and Last().

template<class K, class V, class C>
typedef CTBmapBrowser<K,V,C> CTBmap::Browser
 

Definition at line 33 of file CTBmap.hxx.

Referenced by Find(), FindGreaterEqual(), FindLessEqual(), First(), and Last().


Constructor & Destructor Documentation

template<class K, class V, class C>
CTBmap< K, V, C >::CTBmap [inline]
 

Default constructor.

Definition at line 18 of file CTBmap.icc.

template<class K, class V, class C>
CTBmap< K, V, C >::CTBmap const CTBmap< K, V, C > & rhs [inline]
 

Copy constructor.

Definition at line 37 of file CTBmap.icc.

template<class K, class V, class C>
CTBmap< K, V, C >::~CTBmap [inline]
 

Destructor.

The destructor releases the whole map without executing the comparison operator. This is important when maps are released where T is the pointer to the actual key.

Definition at line 30 of file CTBmap.icc.


Member Function Documentation

template<class K, class V, class C>
bool CTBmap< K, V, C >::Insert const CTBpair< const K, V > & pair
 

Insert key value pair.

Definition at line 29 of file CTBmap.cxx.

template<class K, class V, class C>
bool CTBmap< K, V, C >::Insert const K & key,
const V & value
 

Insert key value pair.

Definition at line 44 of file CTBmap.cxx.

template<class K, class V, class C>
bool CTBmap< K, V, C >::Insert const K & key
 

Insert key with default value.

Definition at line 59 of file CTBmap.cxx.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::Find const K & key
 

Find entry with key key.

Definition at line 74 of file CTBmap.cxx.

Referenced by Rename().

template<class K, class V, class C>
CTBmapBrowser< K, V, C > CTBmap< K, V, C >::Find const K & key const
 

Find entry with key key.

Definition at line 88 of file CTBmap.cxx.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::FindLessEqual const K & key,
bool & b_found
[inline]
 

Find entry with key key, return previous if no match found.

Definition at line 44 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapBrowser< K, V, C > CTBmap< K, V, C >::FindLessEqual const K & key,
bool & b_found
const [inline]
 

Find entry with key key, return previous if no match found.

Definition at line 54 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::FindGreaterEqual const K & key,
bool & b_found
[inline]
 

Find entry with key key, return next if no match found.

Definition at line 64 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapBrowser< K, V, C > CTBmap< K, V, C >::FindGreaterEqual const K & key,
bool & b_found
const [inline]
 

Find entry with key key, return next if no match found.

Definition at line 74 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::FindOrCreate const K & key,
bool & b_found
 

Find entry with key key, create one with default value if none found.

Definition at line 102 of file CTBmap.cxx.

Referenced by operator[]().

template<class K, class V, class C>
bool CTBmap< K, V, C >::Rename const K & keyold,
const K & keynew
 

Rename key of entry with key keyold to keynew.

Returns false if there is no entry with key keyold or if there is already another entry with a key of keynew.

Definition at line 126 of file CTBmap.cxx.

template<class K, class V, class C>
bool CTBmap< K, V, C >::Rename const CTBmapIterator< K, V, C > & p,
const K & keynew
 

Rename key of entry p to keynew.

Returns false if iterator in not valid or if there is already another entry with a key of keynew.

Definition at line 140 of file CTBmap.cxx.

template<class K, class V, class C>
bool CTBmap< K, V, C >::Delete const K & key
 

Delete entry with key key.

Returns false if no entry with key key is found.

Definition at line 180 of file CTBmap.cxx.

template<class K, class V, class C>
bool CTBmap< K, V, C >::Delete const CTBmapIterator< K, V, C > & p
 

Delete entry p.

Returns false if iterator p is not valid.

Definition at line 198 of file CTBmap.cxx.

template<class K, class V, class C>
void CTBmap< K, V, C >::Clear
 

Delete al entries of the map.

Reimplemented from CTBbtree.

Definition at line 211 of file CTBmap.cxx.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::First [inline]
 

Return iterator to first entry.

Definition at line 84 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapBrowser< K, V, C > CTBmap< K, V, C >::First const [inline]
 

Return browser to first entry.

Reimplemented from CTBbtree.

Definition at line 93 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapIterator< K, V, C > CTBmap< K, V, C >::Last [inline]
 

Return iterator to last entry.

Definition at line 102 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapBrowser< K, V, C > CTBmap< K, V, C >::Last const [inline]
 

Return browser to first entry.

Reimplemented from CTBbtree.

Definition at line 111 of file CTBmap.icc.

template<class K, class V, class C>
CTBint CTBmap< K, V, C >::Size const [inline]
 

Return number of entries (see size).

Reimplemented from CTBbtree.

Definition at line 120 of file CTBmap.icc.

template<class K, class V, class C>
void CTBmap< K, V, C >::Dump int i_indent = 0,
ostream & os = cout,
const char * p_text = 0
const [inline]
 

Dump.

Reimplemented from CTBbtree.

Definition at line 129 of file CTBmap.icc.

template<class K, class V, class C>
V & CTBmap< K, V, C >::operator[] const K & key [inline]
 

Access entry with key key.

The value of the entry with the key key is accessed. If there is no such entry, an entry with key key and the default value will be created first.

Definition at line 144 of file CTBmap.icc.

template<class K, class V, class C>
CTBmap< K, V, C > & CTBmap< K, V, C >::operator= const CTBmap< K, V, C > & rhs [inline]
 

Delete all old entries, copy all entries from rhs.

Definition at line 154 of file CTBmap.icc.

template<class K, class V, class C>
CTBmap< K, V, C >::operator bool const [inline]
 

true if not empty.

Definition at line 164 of file CTBmap.icc.

template<class K, class V, class C>
CTBmapNode< K, V, C > * CTBmap< K, V, C >::LocateMatchOrBound const K & key,
int & i_mtype
const [private]
 

Locate nearest entry.

Returns a pointer to a node with key key or, if none exists, to a node with a key immediately before or after key. The parameter i_mtype is set to 0 in case of a match, -1 if key<node and +1 if key>node. A null pointer is returned if the map is empty.

Definition at line 228 of file CTBmap.cxx.

Referenced by Delete(), Find(), FindOrCreate(), Insert(), LocateMatchOrNext(), LocateMatchOrPrev(), and Rename().

template<class K, class V, class C>
CTBmapNode< K, V, C > * CTBmap< K, V, C >::LocateMatchOrPrev const K & key,
bool & b_found
const [private]
 

Locate entry with key key, return previous if no match found.

Definition at line 269 of file CTBmap.cxx.

Referenced by FindLessEqual().

template<class K, class V, class C>
CTBmapNode< K, V, C > * CTBmap< K, V, C >::LocateMatchOrNext const K & key,
bool & b_found
const [private]
 

Locate entry by key, return next if no match found.

Definition at line 287 of file CTBmap.cxx.

Referenced by FindGreaterEqual().

template<class K, class V, class C>
void CTBmap< K, V, C >::InsertNode CTBmapNode< K, V, C > * p_node,
CTBmapNode< K, V, C > * p_parent,
int i_ctype
[inline, private]
 

Insert node into map.

The node p_node is added as child of node p_parent, either as left child if i_ctype is <0 or as right child if i_ctype is >0. If p_node is 0 and i_ctype is 0 the node is inserted as root node.

Definition at line 178 of file CTBmap.icc.

Referenced by FindOrCreate(), Insert(), and Rename().

template<class K, class V, class C>
void CTBmap< K, V, C >::RemoveNode CTBmapNode< K, V, C > * p_node [inline, private]
 

Remove node from map.

Definition at line 189 of file CTBmap.icc.

Referenced by Rename().


The documentation for this class was generated from the following files:
Generated at Fri Oct 24 18:13:53 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001