VMware GemFire Native Client Cache Reference  9.0.6
HashSetOfSharedBase.hpp
Go to the documentation of this file.
1 #ifndef _GEMFIRE_HASHSETOFSHAREDBASE_HPP_
2 #define _GEMFIRE_HASHSETOFSHAREDBASE_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_set>
18 #endif
19 
20 
24 namespace gemfire
25 {
26 
27 #ifdef BUILD_CPPCACHE
28  typedef std::unordered_set< SharedBasePtr, HashSB, EqualToSB > HSofSBP;
29  typedef HSofSBP::const_iterator HSofSBPIterator;
30 #else
31  class HSofSBP;
32  class HSofSBPIterator;
33 #endif
34 
35 
39  {
40  private:
41 
42  HSofSBP* m_stdHashSet;
43 
44  // Never defined.
46 
47 
48  public:
49 
52  {
53  private:
54 
55  const HashSetOfSharedBase& m_set;
56  HSofSBPIterator* m_iter;
57 
58  Iterator( const HSofSBPIterator& iter,
59  const HashSetOfSharedBase& set );
60 
61  // Never defined.
62  Iterator( );
63 
64 
65  public:
66 
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 
86  friend class HashSetOfSharedBase;
87  private:
88  const Iterator& operator=( const Iterator& );
89 
90  };
91 
92 
94  int32_t size( ) const;
95 
97  int32_t max_size( ) const;
98 
100  bool empty( ) const;
101 
103  int32_t bucket_count( ) const;
104 
106  void resize( int32_t n );
107 
109  void swap( HashSetOfSharedBase& other );
110 
112  bool insert( const SharedBasePtr& k );
113 
115  int32_t erase( const SharedBasePtr& k );
116 
118  void clear( );
119 
121  bool contains( const SharedBasePtr& k ) const;
122 
124  int32_t count( const SharedBasePtr& k ) const;
125 
127  Iterator begin( ) const;
128 
130  Iterator end( ) const;
131 
133  HashSetOfSharedBase& operator = ( const HashSetOfSharedBase& other );
134 
138  HashSetOfSharedBase( const Hasher h, const EqualTo k );
139 
143  HashSetOfSharedBase( int32_t n, const Hasher h, const EqualTo k );
144 
147 
150 
151  };
152 
153 }
154 
155 
156 #endif
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
Interface of an iterator for HashSetOfSharedBase.
Definition: HashSetOfSharedBase.hpp:51
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
Represents a HashSet of SharedBase
Definition: HashSetOfSharedBase.hpp:38
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:35

GemFire C++ Cache API Documentation