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

CTBgset.hxx

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

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