1 #ifndef SQL_HSET_INCLUDED
2 #define SQL_HSET_INCLUDED
18 #include "my_global.h"
26 template <
typename T, my_hash_get_key K>
31 enum { START_SIZE= 8 };
38 my_hash_clear(&m_hash);
46 my_hash_free(&m_hash);
59 my_hash_init_opt(&m_hash, &my_charset_bin, START_SIZE, 0, 0, K, 0, MYF(0));
61 const uchar *key= K(reinterpret_cast<uchar*>(value), &key_len, FALSE);
62 if (my_hash_search(&m_hash, key, key_len) == NULL)
63 return my_hash_insert(&m_hash, reinterpret_cast<uchar *>(value));
67 bool is_empty()
const {
return m_hash.records == 0; }
69 size_t size()
const {
return static_cast<size_t>(m_hash.records); }
75 : m_hash(&hash_set.m_hash),
84 if (m_idx < m_hash->records)
85 return reinterpret_cast<T*
>(my_hash_element(m_hash, m_idx++));
88 void rewind() { m_idx= 0; }
97 #endif // SQL_HSET_INCLUDED