Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmt_vmap< K, T > Class Template Reference

#include <cmt_map.h>

List of all members.

Public Member Functions

 cmt_vmap ()
 Constructor.

 ~cmt_vmap ()
 Destructor.

void clear ()
 clear: erase everything from this map

void add (const K &key, T &t)
 Add an entry.

bool has (const K &key) const
 Finds whether there is a node holding that key.

const T * find (const K &key) const
 Finds the value associated with that key.

const cmt_vnode< K, T > * find_node (const K &key) const
 Finds the node containing the value associated with that key.


Private Attributes

cmt_vnode< K, T > * m_top

template<class K, class T>
class cmt_vmap< K, T >


Constructor & Destructor Documentation

template<class K, class T>
cmt_vmap< K, T >::cmt_vmap  )  [inline]
 

Constructor.

Definition at line 446 of file cmt_map.h.

00446               : m_top (0)
00447   {
00448   }

template<class K, class T>
cmt_vmap< K, T >::~cmt_vmap  )  [inline]
 

Destructor.

Definition at line 453 of file cmt_map.h.

00454   {
00455     clear ();
00456   }


Member Function Documentation

template<class K, class T>
void cmt_vmap< K, T >::add const K &  key,
T &  t
[inline]
 

Add an entry.

Existing entries with the same key will be overridden

Definition at line 475 of file cmt_map.h.

00476   {
00477     if (m_top == 0)
00478       {
00479         m_top = new cmt_vnode<K, T> (key, t);
00480       }
00481     else
00482       {
00483         m_top->add (key, t);
00484       }
00485   }

template<class K, class T>
void cmt_vmap< K, T >::clear  )  [inline]
 

clear: erase everything from this map

Definition at line 461 of file cmt_map.h.

Referenced by cmt_vmap< cmt_string, int >::~cmt_vmap().

00462   {
00463     if (m_top != 0)
00464       {
00465         delete m_top;
00466         m_top = 0;
00467       }
00468   }

template<class K, class T>
const T* cmt_vmap< K, T >::find const K &  key  )  const [inline]
 

Finds the value associated with that key.

Returns 0 if not found

Definition at line 506 of file cmt_map.h.

00507   {
00508     if (m_top != 0)
00509       {
00510         return (m_top->find (key));
00511       }
00512     else
00513       {
00514         return (0);
00515       }
00516   }

template<class K, class T>
const cmt_vnode<K, T>* cmt_vmap< K, T >::find_node const K &  key  )  const [inline]
 

Finds the node containing the value associated with that key.

Returns 0 if not found

Definition at line 522 of file cmt_map.h.

00523   {
00524     if (m_top == 0) return (0);
00525 
00526     return (m_top->find_node (key));
00527   }

template<class K, class T>
bool cmt_vmap< K, T >::has const K &  key  )  const [inline]
 

Finds whether there is a node holding that key.

Definition at line 490 of file cmt_map.h.

00491   {
00492     if (m_top != 0)
00493       {
00494         return (m_top->has (key));
00495       }
00496     else
00497       {
00498         return (false);
00499       }
00500   }


Member Data Documentation

template<class K, class T>
cmt_vnode<K, T>* cmt_vmap< K, T >::m_top [private]
 

Definition at line 530 of file cmt_map.h.


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:31 2005 for CMT by doxygen 1.3.5