34 #include "../base/ver.h"
38 #include "../base/str.h"
41 #ifndef CHECK_INCLUDED
42 #include "../base/check.h"
46 #include "../mem/page.h"
49 #ifndef MPOOL_INCLUDED
50 #include "../mem/mpool.h"
53 #ifndef RELSIZE_INCLUDED
54 #include "../rel/relsize.h"
58 #include "../rel/rel.h"
70 static const int SET_MAXPAGES = 1024;
82 static const long SET_MAGIC = 0x5345540AL;
102 #define SET_NODE_T set_node_c<T>*
103 #define SET_NODE_NULL (static_cast<set_node_c<T> *>(0))
164 bool contains(T elem)
const {
169 int hash_val = elem.hash();
170 CHECK(hash_val >= 0,
"set_c::contains: hash_val is negative");
171 hash_val %= HashSize;
174 SET_NODE_T *hashtab_entry =
175 HashTab[hash_val / PAGE_SIZE(SET_NODE_T)];
176 hashtab_entry += (hash_val % PAGE_SIZE(SET_NODE_T));
180 for(node = *hashtab_entry; node != SET_NODE_NULL;
182 if(node->Elem == elem)
192 int hash_size()
const {
201 int entries_used()
const {
210 int size_value(relsize_t relsize)
const {
212 CHECK(relsize_valid(relsize),
213 "set_c::size_value: invalid size measure");
217 case RELSIZE_OBJ_SIZE:
218 return static_cast<int>(
sizeof(
set_c<T>));
219 case RELSIZE_HASHTAB_SIZE:
221 case RELSIZE_ENTRIES_USED:
#define CHECK_VALID(EX)
Definition: check.h:85
const char * str_t
Definition: str.h:41
#define STR_NULL
Definition: str.h:52
#define CHECK(EX, MSG)
Definition: check.h:69