/export/rook2/users/build/gfcppsancout64/product/include/gfcpp/CacheableKey.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_CACHEABLEKEY_H__
00002 #define __GEMFIRE_CACHEABLEKEY_H__
00003 /*=========================================================================
00004  * (c) Copyright 2002-2007, GemStone Systems, Inc. All Rights Reserved.
00005  * 1260 NW Waterhouse Ave., Suite 200,  Beaverton, OR 97006
00006  *========================================================================
00007  */
00008 
00009 #include "gfcpp_globals.hpp"
00010 #include "gf_types.hpp"
00011 #include "Cacheable.hpp"
00012 
00017 namespace gemfire
00018 {
00019 
00021 class CPPCACHE_EXPORT CacheableKey
00022       : public Cacheable
00023 {
00024 
00025 protected:
00026 
00028   CacheableKey( )
00029 : Cacheable( )
00030   {}
00031 
00033   virtual ~CacheableKey( )
00034   {
00035   }
00036 
00037 public:
00038 
00040   virtual bool operator==( const CacheableKey& other ) const = 0;
00041 
00043   virtual uint32_t hashcode( ) const = 0;
00044 
00053   virtual int32_t logString( char* buffer, int32_t maxLength ) const;
00054 
00062   template< class PRIM >
00063   inline static CacheableKeyPtr create( const PRIM value )
00064   {
00065     return createKey( value );
00066   }
00067 
00068 private:
00069 
00070   // Never defined.
00071   CacheableKey( const CacheableKey& other );
00072   void operator = ( const CacheableKey& other );
00073 
00074 };
00075 
00076 template <class TKEY>
00077 inline CacheableKeyPtr createKey( const SharedPtr< TKEY >& value )
00078 {
00079   return CacheableKeyPtr( value );
00080 }
00081 
00082 template <typename TKEY>
00083 inline CacheableKeyPtr createKey( const TKEY* value )
00084 {
00085   return createKeyArr( value );
00086 }
00087 
00088 }
00089 
00090 #endif

GemFire C++ Cache API Documentation