VMware GemFire Native C++ Reference  9.1
HashSetOfSharedBase.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_HASHSETOFSHAREDBASE_H_
4 #define GEODE_HASHSETOFSHAREDBASE_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "geode_globals.hpp"
24 #include "SharedPtr.hpp"
25 #include "HashFunction.hpp"
26 #ifdef BUILD_CPPCACHE
27 #include <unordered_set>
28 #endif
29 
33 namespace apache {
34 namespace geode {
35 namespace client {
36 
37 #ifdef BUILD_CPPCACHE
38 typedef std::unordered_set<SharedBasePtr, HashSB, EqualToSB> HSofSBP;
39 typedef HSofSBP::const_iterator HSofSBPIterator;
40 #else
41 class HSofSBP;
42 class HSofSBPIterator;
43 #endif
44 
48  private:
49  HSofSBP* m_stdHashSet;
50 
51  // Never defined.
53 
54  public:
57  private:
58  const HashSetOfSharedBase& m_set;
59  HSofSBPIterator* m_iter;
60 
61  Iterator(const HSofSBPIterator& iter, const HashSetOfSharedBase& set);
62 
63  // Never defined.
64  Iterator();
65 
66  public:
67  Iterator(const Iterator& other);
68 
69  const SharedBasePtr operator*() const;
70 
71  bool isEnd() const;
72 
73  Iterator& operator++();
74 
75  void operator++(int);
76 
77  bool operator==(const Iterator& other) const;
78 
79  bool operator!=(const Iterator& other) const;
80 
81  void reset();
82 
83  ~Iterator();
84 
85  friend class HashSetOfSharedBase;
86 
87  private:
88  const Iterator& operator=(const Iterator&);
89  };
90 
92  int32_t size() const;
93 
95  int32_t max_size() const;
96 
98  bool empty() const;
99 
101  int32_t bucket_count() const;
102 
104  void resize(int32_t n);
105 
107  void swap(HashSetOfSharedBase& other);
108 
110  bool insert(const SharedBasePtr& k);
111 
113  int32_t erase(const SharedBasePtr& k);
114 
116  void clear();
117 
119  bool contains(const SharedBasePtr& k) const;
120 
122  int32_t count(const SharedBasePtr& k) const;
123 
125  Iterator begin() const;
126 
128  Iterator end() const;
129 
131  HashSetOfSharedBase& operator=(const HashSetOfSharedBase& other);
132 
136  HashSetOfSharedBase(const Hasher h, const EqualTo k);
137 
141  HashSetOfSharedBase(int32_t n, const Hasher h, const EqualTo k);
142 
145 
148 };
149 } // namespace client
150 } // namespace geode
151 } // namespace apache
152 
153 #endif // GEODE_HASHSETOFSHAREDBASE_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
bool(* EqualTo)(const SharedBasePtr &, const SharedBasePtr &)
typedef for the hashing key equality function.
Definition: HashFunction.hpp:38
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
int32_t(* Hasher)(const SharedBasePtr &)
typedef for the hash function used by the hashing schemes.
Definition: HashFunction.hpp:35
Represents a HashSet of SharedBase
Definition: HashSetOfSharedBase.hpp:47
Interface of an iterator for HashSetOfSharedBase.
Definition: HashSetOfSharedBase.hpp:56
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation