Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef HASHSET_H_
00013 #define HASHSET_H_
00014
00015 #include <shogun/base/SGObject.h>
00016 #include <shogun/lib/common.h>
00017 #include <shogun/lib/Hash.h>
00018
00019 namespace shogun
00020 {
00021
00022 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00023
00024 struct HashSetNode
00025 {
00027 int32_t key;
00028
00030 float64_t data;
00031
00033 HashSetNode *left;
00034
00036 HashSetNode *right;
00037 };
00038 #endif
00039
00043 class CHashSet: public CSGObject
00044 {
00045 public:
00046 CHashSet();
00047
00049 CHashSet(int32_t size);
00050
00051 virtual inline const char* get_name() const
00052 {
00053 return "HashSet";
00054 }
00055
00056 virtual ~CHashSet();
00057
00059 bool insert_key(int32_t key, float64_t data);
00060
00062 bool search_key(int32_t key, float64_t &ret_data);
00063
00065 void delete_key(int32_t key);
00066
00068 void debug();
00069 private:
00073 int32_t hash(int32_t key);
00074
00076 HashSetNode* chain_search(int32_t index, int32_t key);
00077
00078 protected:
00080 HashSetNode **hash_array;
00081
00083 int32_t array_size;
00084 };
00085
00086 }
00087
00088 #endif