00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __TOOLBOX_HASHSET_H
00010 #define __TOOLBOX_HASHSET_H
00011
00012
00013 namespace toolbox
00014 {
00026 class HashSet : protected HashMap<Void>
00027 {
00028 public:
00029
00033 HashSet();
00034
00040 HashSet(long initSize);
00041
00053 HashSet(long initSize, int desiredFillRatio);
00054
00059 virtual ~HashSet();
00060
00071 inline void Add(void * key);
00072
00079 inline bool Contains(void * key) const;
00080
00088 inline PointeredList * GetAll() const;
00089
00094 inline long GetCount() const;
00095
00100 inline bool IsEmpty() const;
00101
00109 inline void Remove(void * key);
00110
00116 inline void RemoveAll();
00117
00118 #ifdef _TOOLBOX_TEST
00119
00125 static void RunTestSuite(int * performedTests, int * failedTests);
00126 #endif
00127 };
00128
00129
00135 class IntKeyHashSet : public IntKeyHashMap<Void>
00136 {
00137 public:
00138
00142 IntKeyHashSet();
00143
00149 IntKeyHashSet(long initSize);
00150
00162 IntKeyHashSet(long initSize, int desiredFillRatio);
00163
00168 virtual ~IntKeyHashSet();
00169
00179 inline void Add(long key);
00180
00186 inline bool Contains(long key) const;
00187
00195 inline PointeredList * GetAll() const;
00196
00203 inline void Remove(long key);
00204
00210 inline void RemoveAll();
00211
00212 #ifdef _TOOLBOX_TEST
00213
00219 static void RunTestSuite(int * performedTests, int * failedTests);
00220 #endif
00221 };
00222
00223
00231 class StringKeyHashSet : public StringKeyHashMap<Void>
00232 {
00233 public:
00234
00238 StringKeyHashSet();
00239
00245 StringKeyHashSet(long initSize);
00246
00258 StringKeyHashSet(long initSize, int desiredFillRatio);
00259
00264 virtual ~StringKeyHashSet();
00265
00275 inline void Add(const char * key);
00276
00282 inline bool Contains(const char * key) const;
00283
00291 inline PointeredList * GetAll() const;
00292
00299 inline void Remove(const char * key);
00300
00306 inline void RemoveAll();
00307
00308 #ifdef _TOOLBOX_TEST
00309
00315 static void RunTestSuite(int * performedTests, int * failedTests);
00316 #endif
00317 };
00318
00319
00325 class ICStringKeyHashSet : public ICStringKeyHashMap<Void>
00326 {
00327 public:
00328
00332 ICStringKeyHashSet();
00333
00339 ICStringKeyHashSet(long initSize);
00340
00352 ICStringKeyHashSet(long initSize, int desiredFillRatio);
00353
00358 virtual ~ICStringKeyHashSet();
00359
00369 inline void Add(const char * key);
00370
00376 inline bool Contains(const char * key) const;
00377
00385 inline PointeredList * GetAll() const;
00386
00393 inline void Remove(const char * key);
00394
00400 inline void RemoveAll();
00401
00402 #ifdef _TOOLBOX_TEST
00403
00409 static void RunTestSuite(int * performedTests, int * failedTests);
00410 #endif
00411 };
00412 }
00413
00414
00415 #endif