CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

hashmapr.h

00001 /*
00002     Copyright (C) 2002 by Mathew Sutcliffe
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_HASHMAPR_H__
00020 #define __CS_HASHMAPR_H__
00021 
00022 #include "csextern.h"
00023 #include "hashmap.h"
00024 
00025 class CS_CSUTIL_EXPORT csHashIteratorReversible;
00026 
00028 class csHashMapReversible : public csHashMap
00029 {
00030   friend class csHashIteratorReversible;
00031 
00032 protected:
00033   csHashMap *Reverse;
00034   csHashMap *HalfReverse;
00035 
00036 public:
00037   csHashMapReversible (uint32 size = 211);
00038   csHashMapReversible (const csHashMapReversible& m);
00039 
00040   csHashMapReversible& operator= (const csHashMapReversible& other);
00041 
00042   virtual ~csHashMapReversible ();
00043 
00046   void Put (const char *key, csHashObject object);
00047 
00049   const char* GetKey (csHashObject value) const;
00050 
00052   const char* GetKey (csHashKey key) const;
00053   
00055   csHashObject Get (const char* key) const;
00056 
00064   csHashObject Get (csHashKey key) const
00065   { return csHashMap::Get (key); }
00066 
00068   void Delete (const char* key, csHashObject object);
00069 };
00070 
00072 class CS_CSUTIL_EXPORT csGlobalHashIteratorReversible : public csGlobalHashIterator
00073 {
00074   friend class csHashMapReversible;
00075 
00076 private:
00077   csHashMapReversible *hashr;
00079   csHashBucket* current_bucket;
00081   size_t current_index;
00082 
00083 public:
00085   csGlobalHashIteratorReversible (csHashMapReversible *hash);
00086 
00088   const char* GetKey () const;
00089 
00091   csHashObject Next ();
00092 };
00093 
00095 class CS_CSUTIL_EXPORT csHashIteratorReversible : public csHashIterator
00096 {
00097   friend class csHashMapReversible;
00098 
00099 private:
00100   csHashMapReversible *hashr;
00101   const char *iterr;
00102   csHashKey keyr;
00103 
00104 public:
00106   csHashIteratorReversible (csHashMapReversible *hash, csHashKey key);
00107 
00109   csHashIteratorReversible (csHashMapReversible *hash, const char *key);
00110 
00112   csHashObject Next ();
00113 
00115   const char* GetKey () const;
00116 };
00117 
00118 #endif // __CS_HASHMAPR_H__
00119 

Generated for Crystal Space by doxygen 1.3.9.1