VMware GemFire Native Client Cache Reference  9.0.6
HashMapOfSharedBase.hpp
Go to the documentation of this file.
1 #ifndef _GEMFIRE_HASHMAPOFSHAREDBASE_HPP_
2 #define _GEMFIRE_HASHMAPOFSHAREDBASE_HPP_
3 
4 
5 /*=========================================================================
6  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
7  * This product is protected by U.S. and international copyright
8  * and intellectual property laws. Pivotal products are covered by
9  * more patents listed at http://www.pivotal.io/patents.
10  *========================================================================
11  */
12 
13 #include "gfcpp_globals.hpp"
14 #include "SharedPtr.hpp"
15 #include "HashFunction.hpp"
16 #ifdef BUILD_CPPCACHE
17 #include <unordered_map>
18 #endif
19 
20 
24 namespace gemfire
25 {
26 
27 #ifdef BUILD_CPPCACHE
28  typedef std::unordered_map< SharedBasePtr, SharedBasePtr,
29  HashSB, EqualToSB > HMofSBP;
30  typedef HMofSBP::const_iterator HMofSBPIterator;
31 #else
32  class HMofSBP;
33  class HMofSBPIterator;
34 #endif
35 
36 
40  {
41  private:
42 
43  HMofSBP* m_stdHashMap;
44 
45  // Never defined.
47 
48 
49  public:
50 
53  {
54  private:
55 
56  HMofSBPIterator* m_iter;
57 
58  Iterator( const HMofSBPIterator& iter );
59 
60  // Never defined
61  Iterator( );
62 
63 
64  public:
65 
66  Iterator( const Iterator& other );
67 
68  const SharedBasePtr first( ) const;
69 
70  const SharedBasePtr second( ) const;
71 
72  Iterator& operator ++ ( );
73 
74  void operator ++ ( int );
75 
76  bool operator == ( const Iterator& other ) const;
77 
78  bool operator != ( const Iterator& other ) const;
79 
80  ~Iterator( );
81 
82 
83  friend class HashMapOfSharedBase;
84 
85  private:
86  const Iterator& operator=( const Iterator& );
87  };
88 
89 
91  int32_t size( ) const;
92 
94  int32_t max_size( ) const;
95 
97  bool empty( ) const;
98 
100  int32_t bucket_count( ) const;
101 
103  void resize( int32_t n );
104 
106  void swap( HashMapOfSharedBase& other );
107 
111  bool insert( const SharedBasePtr& k, const SharedBasePtr& v );
112 
114  int32_t erase( const SharedBasePtr& k );
115 
117  void clear( );
118 
120  bool contains( const SharedBasePtr& k ) const;
121 
123  Iterator find( const SharedBasePtr& k ) const;
124 
126  int32_t count( const SharedBasePtr& k ) const;
127 
131  SharedBasePtr& operator [] ( const SharedBasePtr& k );
132 
134  Iterator begin( ) const;
135 
137  Iterator end( ) const;
138 
140  HashMapOfSharedBase& operator = ( const HashMapOfSharedBase& other );
141 
145  HashMapOfSharedBase( const Hasher h, const EqualTo k );
146 
150  HashMapOfSharedBase( int32_t n, const Hasher h, const EqualTo k );
151 
154 
157  };
158 
159 }
160 
161 
162 #endif
Interface of an iterator for HashMapOfSharedBase.
Definition: HashMapOfSharedBase.hpp:52
Represents a HashMap of SharedBase
Definition: HashMapOfSharedBase.hpp:39
bool(* EqualTo)(const SharedBasePtr &, const SharedBasePtr &)
typedef for the hashing key equality function.
Definition: HashFunction.hpp:28
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
int32_t(* Hasher)(const SharedBasePtr &)
typedef for the hash function used by the hashing schemes.
Definition: HashFunction.hpp:25
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51

GemFire C++ Cache API Documentation