35 return cfloor(a / _threshold + 0.5f) < cfloor(b / _threshold + 0.5f);
46 return (a.compare_to(b) < 0);
57 return (a.compare_to(b) == 0);
68 return (a != b && (*a) < (*b));
79 return (a != b && (*a).compare_to(*b) < 0);
90 return (a == b || (*a).compare_to(*b) == 0);
101 return (a != b && (*a).get_name() < (*b).get_name());
112 return (a == b || (*a).get_name() == (*b).get_name());
120 template<
class Key,
class Compare>
123 PN_uint32 key32 = (PN_uint32)(key);
135 PN_uint32 key32 = (PN_uint32)reinterpret_cast<unsigned long>(key);
147 _threshold(threshold)
159 return add_hash(0, key);
170 return cfloor(a / _threshold + 0.5f) < cfloor(b / _threshold + 0.5f);
181 PN_uint32 key32 = (PN_uint32)(key / _threshold + 0.5f);
191 template<
class Key,
class Compare>
194 return add_hash(0, key);
203 template<
class Key,
class Compare>
208 if (key.size() > 0) {
209 assert(&key[key.size() - 1] - &key[0] == key.size() - 1);
212 size_t num_bytes = (key.size() *
sizeof(key[0]));
221 template<
class Key,
class Compare>
224 return key.get_hash();
232 template<
class Key,
class Compare>
235 return (*key).get_hash();
246 return (*key).get_hash();
257 return (a == b || (*a) == (*b));
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
size_t operator()(const Key &key) const
Computes a size_t hash from the float.
static size_t add_hash(size_t start, const PN_uint32 *words, size_t num_words)
Adds a linear sequence of uint32 words to the hash.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
This hash_compare class hashes a float or a double.
size_t operator()(const Key &key) const
Trivially computes a size_t hash from the components of the string.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equal to b, false otherwise.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
Compares two floating point numbers, within threshold of equivalence.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
static size_t add_hash(size_t start, const Key &key)
Adds the elements of the indicated key into a running hash.