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

CTBmap.hxx

Go to the documentation of this file.
00001 #ifndef _CTBmap_HXX
00002 #define _CTBmap_HXX 1
00003 
00008 /*----------------------------------------------------------------------------*/
00009 /* C Tool Box: Designed and implemented by:                                   */
00010 /*    Walter F.J. Mueller   Gesellschaft fuer Schwerionenforschung (GSI)      */
00011 /*                          Planckstrasse 1, D-64291 Darmstadt, Germany       */
00012 /*                  Email:  W.F.J.Mueller@gsi.de                              */
00013 /*                  WWW:    http://www-kp3.gsi.de/www/kp3/people/mueller.html */
00014 /*------------------------------------------+---------------------------------*/
00015 
00016 #include "CTBpair.hxx"
00017 #include "CTBbtree.hxx"
00018 
00019 template <class K, class V, class C>
00020 class CTBmapNode;                           // forward declaration
00021 template <class K, class V, class C>
00022 class CTBmapIterator;                       // forward declaration
00023 template <class K, class V, class C>
00024 class CTBmapBrowser;                        // forward declaration
00025 
00026 template <class K, class V, class C>
00027 class CTBmap : private CTBbtree {
00028   public:
00029 
00030     typedef CTBmap<K,V,C>          Map;
00031     typedef CTBmapNode<K,V,C>      Node;
00032     typedef CTBmapIterator<K,V,C>  Iterator;
00033     typedef CTBmapBrowser<K,V,C>   Browser;
00034 
00035                     CTBmap();
00036                     CTBmap(const CTBmap<K,V,C>& rhs);
00037 
00038                     ~CTBmap();
00039 
00040     bool            Insert(const CTBpair<const K,V>& pair);
00041     bool            Insert(const K& key, const V& value);
00042     bool            Insert(const K& key);
00043 
00044     CTBmapIterator<K,V,C> Find(const K& key);
00045     CTBmapBrowser<K,V,C>  Find(const K& key) const;
00046 
00047     CTBmapIterator<K,V,C> FindLessEqual(const K& key, bool& b_found);
00048     CTBmapBrowser<K,V,C>  FindLessEqual(const K& key, bool& b_found) const;
00049 
00050     CTBmapIterator<K,V,C> FindGreaterEqual(const K& key, bool& b_found);
00051     CTBmapBrowser<K,V,C>  FindGreaterEqual(const K& key, bool& b_found) const;
00052 
00053     CTBmapIterator<K,V,C> FindOrCreate(const K& key, bool& b_found);
00054 
00055     bool            Rename(const K& keyold, const K& keynew);
00056     bool            Rename(const CTBmapIterator<K,V,C>& p, const K& keynew);
00057 
00058     bool            Delete(const K& key);
00059     bool            Delete(const CTBmapIterator<K,V,C>& p);
00060     void            Clear();
00061 
00062     CTBmapIterator<K,V,C> First();
00063     CTBmapBrowser<K,V,C>  First() const;
00064 
00065     CTBmapIterator<K,V,C> Last();
00066     CTBmapBrowser<K,V,C>  Last() const;
00067 
00068     CTBint          Size() const;
00069 
00070     void            Dump(int i_indent=0, ostream& os=cout,
00071                          const char* p_text=0) const;
00072 
00073     V&              operator[](const K& key);
00074 
00075     CTBmap<K,V,C>&  operator=(const CTBmap<K,V,C>& rhs);
00076    
00077                     operator bool() const;
00078 
00079   private:
00080 
00081     CTBmapNode<K,V,C>* LocateMatchOrBound(const K& key, int& i_mtype) const;
00082 
00083     CTBmapNode<K,V,C>* LocateMatchOrPrev(const K& key, bool& b_found) const;
00084     CTBmapNode<K,V,C>* LocateMatchOrNext(const K& key, bool& b_found) const;
00085 
00086     void            InsertNode(CTBmapNode<K,V,C>* p_node,
00087                                CTBmapNode<K,V,C>* p_parent, int i_ctype);
00088 
00089     void            RemoveNode(CTBmapNode<K,V,C>* p_node);
00090 };
00091 
00092 #include "CTBmapNode.hxx"
00093 #include "CTBmapIterator.hxx"
00094 
00095 #include "CTBmap.icc"
00096 
00097 #endif

Generated at Fri Oct 24 18:11:28 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001