VMware GemFire Native C++ Reference  9.1
HashMapOfSharedBase.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_HASHMAPOFSHAREDBASE_H_
4 #define GEODE_HASHMAPOFSHAREDBASE_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_map>
28 #endif
29 
33 namespace apache {
34 namespace geode {
35 namespace client {
36 
37 #ifdef BUILD_CPPCACHE
38 typedef std::unordered_map<SharedBasePtr, SharedBasePtr, HashSB, EqualToSB>
39  HMofSBP;
40 typedef HMofSBP::const_iterator HMofSBPIterator;
41 #else
42 class HMofSBP;
43 class HMofSBPIterator;
44 #endif
45 
49  private:
50  HMofSBP* m_stdHashMap;
51 
52  // Never defined.
54 
55  public:
58  private:
59  HMofSBPIterator* m_iter;
60 
61  Iterator(const HMofSBPIterator& iter);
62 
63  // Never defined
64  Iterator();
65 
66  public:
67  Iterator(const Iterator& other);
68 
69  const SharedBasePtr first() const;
70 
71  const SharedBasePtr second() 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  ~Iterator();
82 
83  friend class HashMapOfSharedBase;
84 
85  private:
86  const Iterator& operator=(const Iterator&);
87  };
88 
90  int32_t size() const;
91 
93  int32_t max_size() const;
94 
96  bool empty() const;
97 
99  int32_t bucket_count() const;
100 
102  void resize(int32_t n);
103 
105  void swap(HashMapOfSharedBase& other);
106 
110  bool insert(const SharedBasePtr& k, const SharedBasePtr& v);
111 
113  int32_t erase(const SharedBasePtr& k);
114 
116  void clear();
117 
119  bool contains(const SharedBasePtr& k) const;
120 
122  Iterator find(const SharedBasePtr& k) const;
123 
125  int32_t count(const SharedBasePtr& k) const;
126 
130  SharedBasePtr& operator[](const SharedBasePtr& k);
131 
133  Iterator begin() const;
134 
136  Iterator end() const;
137 
139  HashMapOfSharedBase& operator=(const HashMapOfSharedBase& other);
140 
144  HashMapOfSharedBase(const Hasher h, const EqualTo k);
145 
149  HashMapOfSharedBase(int32_t n, const Hasher h, const EqualTo k);
150 
153 
156 };
157 } // namespace client
158 } // namespace geode
159 } // namespace apache
160 
161 #endif // GEODE_HASHMAPOFSHAREDBASE_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
Interface of an iterator for HashMapOfSharedBase.
Definition: HashMapOfSharedBase.hpp:57
Represents a HashMap of SharedBase
Definition: HashMapOfSharedBase.hpp:48
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation