3 #ifndef GEODE_HASHSETT_H_ 4 #define GEODE_HASHSETT_H_ 23 #include "geode_globals.hpp" 35 template <
typename TKEY>
52 inline const TKEY operator*()
const {
return staticCast<TKEY>(*m_iter); }
54 inline bool isEnd()
const {
return m_iter.isEnd(); }
61 inline void operator++(
int) { m_iter++; }
63 inline bool operator==(
const Iterator& other)
const {
64 return (m_iter == other.m_iter);
67 inline bool operator!=(
const Iterator& other)
const {
68 return (m_iter != other.m_iter);
71 inline void reset() { m_iter.reset(); }
77 return apache::geode::client::hashFunction<TKEY>(staticCast<TKEY>(p));
81 return apache::geode::client::equalToFunction<TKEY>(staticCast<TKEY>(x),
86 inline int32_t
size()
const {
return m_set.
size(); }
109 inline int32_t
erase(
const TKEY& k) {
return m_set.
erase(k); }
118 int32_t
count(
const TKEY& k)
const {
return m_set.
count(k); }
140 inline HashSetT(int32_t n) : m_set(n, hasher, equal_to) {}
169 : _HashSetOfCacheableKey(other) {}
180 #endif // GEODE_HASHSETT_H_ HashSetT()
Creates an empty hash set with hash function hasher<TKEY> and equal to function equal_to<TKEY>.
Definition: HashSetT.hpp:135
void resize(int32_t n)
Increases the bucket count to at least n.
Definition: HashSetT.hpp:98
void clear()
Erases all of the elements.
Definition: HashSetT.hpp:112
bool contains(const SharedBasePtr &k) const
Check if a given key k exists in the hash_set.
HashSetT(const HashSetT &other)
Copy constructor.
Definition: HashSetT.hpp:143
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
bool empty() const
true if the hash_set's size is 0.
int32_t count(const SharedBasePtr &k) const
Counts the number of elements whose key is k.
A hash set of CacheableKey objects that also extends SharedBase for smart pointers.
Definition: HashSetT.hpp:155
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
int32_t bucket_count() const
Returns the number of buckets used by the hash_set.
Interface of an iterator for HashSetT.
Definition: HashSetT.hpp:42
int32_t count(const TKEY &k) const
Counts the number of elements whose key is k.
Definition: HashSetT.hpp:118
int32_t erase(const SharedBasePtr &k)
Erases the element whose key is k.
void resize(int32_t n)
Increases the bucket count to at least n.
_HashSetOfCacheableKey::Iterator Iterator
Iterator class for the hash set.
Definition: HashSetT.hpp:159
HashSetOfCacheableKey(const HashSetOfCacheableKey &other)
Copy constructor.
Definition: HashSetT.hpp:168
int32_t max_size() const
Returns the largest possible size of the hash_set.
bool empty() const
true if the hash set's size is 0.
Definition: HashSetT.hpp:92
Iterator begin() const
Get an iterator pointing to the start of hash_set.
Definition: HashSetT.hpp:121
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
int32_t size() const
Returns the size of the hash set.
Definition: HashSetT.hpp:86
bool contains(const TKEY &k) const
Check if a given key k exists in the hash set.
Definition: HashSetT.hpp:115
int32_t erase(const TKEY &k)
Erases the element whose key is k.
Definition: HashSetT.hpp:109
bool insert(const SharedBasePtr &k)
Inserts the key k into the hash_set.
HashSetOfCacheableKey()
Create an empty HashSet.
Definition: HashSetT.hpp:162
HashSetOfCacheableKey(int32_t n)
Creates an empty hash set with at least n buckets.
Definition: HashSetT.hpp:165
~HashSetT()
Destructor: the destructor of m_set would do required stuff.
Definition: HashSetT.hpp:146
Iterator end() const
Get an iterator pointing to the end of hash_set.
HashSetT & operator=(const HashSetT &other)
Assignment operator.
Definition: HashSetT.hpp:127
HashSet of TKEY.
Definition: HashSetT.hpp:36
int32_t max_size() const
Returns the largest possible size of the hash set.
Definition: HashSetT.hpp:89
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:40
void swap(HashSetT &other)
Swaps the contents of two hash sets.
Definition: HashSetT.hpp:101
Iterator begin() const
Get an iterator pointing to the start of hash_set.
void swap(HashSetOfSharedBase &other)
Swaps the contents of two hash_sets.
Represents a HashSet of SharedBase
Definition: HashSetOfSharedBase.hpp:47
int32_t size() const
Returns the size of the hash_set.
HashSetT(int32_t n)
Creates an empty hash set with at least n buckets and hash function hasher<TKEY> and equal to functio...
Definition: HashSetT.hpp:140
Iterator end() const
Get an iterator pointing to the end of hash_set.
Definition: HashSetT.hpp:124
Interface of an iterator for HashSetOfSharedBase.
Definition: HashSetOfSharedBase.hpp:56
int32_t bucket_count() const
Returns the number of buckets used by the hash set.
Definition: HashSetT.hpp:95
This namespace contains all the Geode C++ API classes, enumerations and globals.
void clear()
Erases all of the elements.
bool insert(const TKEY &k)
Inserts the key k into the hash set, when k does not exist in the hash set.
Definition: HashSetT.hpp:106