build-artifacts/win/product/include/gfcpp/HashMapOfSharedBase.hpp

Go to the documentation of this file.
00001 #ifndef _GEMFIRE_HASHMAPOFSHAREDBASE_HPP_
00002 #define _GEMFIRE_HASHMAPOFSHAREDBASE_HPP_
00003 
00004 
00005 /*=========================================================================
00006  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
00007  * This product is protected by U.S. and international copyright
00008  * and intellectual property laws. Pivotal products are covered by
00009  * more patents listed at http://www.pivotal.io/patents.
00010  *========================================================================
00011  */
00012 
00013 #include "gfcpp_globals.hpp"
00014 #include "SharedPtr.hpp"
00015 #include "HashFunction.hpp"
00016 #ifdef BUILD_CPPCACHE
00017 #include <hash_map>
00018 #endif
00019 
00020 
00024 namespace gemfire
00025 {
00026 
00027 #ifdef BUILD_CPPCACHE
00028   typedef std::hash_map< SharedBasePtr, SharedBasePtr,
00029           HashSB, EqualToSB > HMofSBP;
00030   typedef HMofSBP::const_iterator HMofSBPIterator;
00031 #else
00032   class HMofSBP;
00033   class HMofSBPIterator;
00034 #endif
00035 
00036 
00039   class CPPCACHE_EXPORT HashMapOfSharedBase 
00040   {
00041     private:
00042 
00043       HMofSBP* m_stdHashMap;
00044 
00045       // Never defined.
00046       HashMapOfSharedBase( );
00047 
00048 
00049     public:
00050 
00052       class CPPCACHE_EXPORT Iterator
00053       {
00054         private:
00055 
00056           HMofSBPIterator* m_iter;
00057 
00058           Iterator( const HMofSBPIterator& iter );
00059 
00060           // Never defined
00061           Iterator( );
00062 
00063 
00064         public:
00065 
00066           Iterator( const Iterator& other );
00067 
00068           const SharedBasePtr first( ) const;
00069 
00070           const SharedBasePtr second( ) const;
00071 
00072           Iterator& operator ++ ( );
00073 
00074           void operator ++ ( int );
00075 
00076           bool operator == ( const Iterator& other ) const;
00077 
00078           bool operator != ( const Iterator& other ) const;
00079 
00080           ~Iterator( );
00081 
00082 
00083           friend class HashMapOfSharedBase;
00084 
00085       private:
00086         const Iterator& operator=( const Iterator& );
00087       };
00088 
00089 
00091       int32_t size( ) const;
00092 
00094       int32_t max_size( ) const;
00095 
00097       bool empty( ) const;
00098 
00100       int32_t bucket_count( ) const;
00101 
00103       void resize( int32_t n );
00104 
00106       void swap( HashMapOfSharedBase& other );
00107 
00111       bool insert( const SharedBasePtr& k, const SharedBasePtr& v );
00112 
00114       int32_t erase( const SharedBasePtr& k );
00115 
00117       void clear( );
00118 
00120       bool contains( const SharedBasePtr& k ) const;
00121 
00123       Iterator find( const SharedBasePtr& k ) const;
00124 
00126       int32_t count( const SharedBasePtr& k ) const;
00127 
00131       SharedBasePtr& operator [] ( const SharedBasePtr& k );
00132 
00134       Iterator begin( ) const;
00135 
00137       Iterator end( ) const;
00138 
00140       HashMapOfSharedBase& operator = ( const HashMapOfSharedBase& other );
00141 
00145       HashMapOfSharedBase( const Hasher h, const EqualTo k );
00146 
00150       HashMapOfSharedBase( int32_t n, const Hasher h, const EqualTo k );
00151 
00153       HashMapOfSharedBase( const HashMapOfSharedBase& other );
00154 
00156       ~HashMapOfSharedBase( );
00157   };
00158 
00159 }
00160 
00161 
00162 #endif

GemFire C++ Cache API Documentation