00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EASYSOK_HASH_INC_GUARD_H
00022 #define EASYSOK_HASH_INC_GUARD_H
00023
00024
00025 #include <vector>
00026
00027 #include <qglobal.h>
00028
00029
00030 class Map;
00031
00032
00033
00034
00046 class Hash
00047 {
00048
00049 public:
00050
00057 Hash(Map const & map);
00058
00059
00070 Hash(Map const & map, std::vector<int> const & positions);
00071
00072
00079 Hash(Hash const & other_hash);
00080
00081
00086 ~Hash();
00087
00088
00095 Hash & operator = (Hash const & other_hash);
00096
00097
00104 bool operator == (Hash const & other_hash) const;
00105
00106
00113 bool operator != (Hash const & other_hash) const;
00114
00115
00122 bool operator < (Hash const & other_hash) const;
00123
00124
00125 private:
00126
00134 void calcHash(Map const & map, std::vector<int> const & positions);
00135
00136
00141 bool onHeap() const;
00142
00143
00148 Q_UINT32 m_data0;
00149
00150
00155 union
00156 {
00157 struct OnStack
00158 {
00159 Q_UINT32 m_data1;
00160 Q_UINT32 m_data2;
00161 } on_stack;
00162
00163 struct
00164 {
00165 Q_UINT32 m_size;
00166 Q_UINT32 * m_data;
00167 } on_heap;
00168 } rest;
00169
00170 };
00171
00172
00173
00174 #endif