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

00001 #ifndef __GEMFIRE_PDXSERIALIZABLE_H__
00002 #define __GEMFIRE_PDXSERIALIZABLE_H__
00003 
00004 /*=========================================================================
00005 * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
00006  * This product is protected by U.S. and international copyright
00007  * and intellectual property laws. Pivotal products are covered by
00008  * more patents listed at http://www.pivotal.io/patents.
00009 *========================================================================
00010 */
00011 
00012 #include "CacheableKey.hpp"
00013 
00014 namespace gemfire
00015 {
00016 
00017 typedef PdxSerializable* ( *PdxTypeFactoryMethod ) ();
00018 
00019 class CPPCACHE_EXPORT  PdxSerializable : public CacheableKey
00020 {
00021 
00022 public:
00023 
00024   PdxSerializable();
00025   virtual ~PdxSerializable();
00026 
00027   // for virtual overloads bring base toData/fromData in scope otherwise
00028   // child classes won't be able to override as desired
00029   // Solaris compiler gives "hides the virtual function" warnings when
00030   // compiling child classes while other compilers silently
00031   // accept but will cause problems with overloaded calls (in this case
00032   //   no implicit conversion from PdxWriterPtr to DataOutput etc exists
00033   //   so no imminent danger)
00034   // see http://www.parashift.com/c++-faq-lite/hiding-rule.html
00035   //     http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/cplusplus-faq-355066.html#Coding1
00036   //using Serializable::toData;
00037   //using Serializable::fromData;
00038 
00043   virtual void toData( PdxWriterPtr output ) /*const*/ = 0;
00044 
00049   virtual void fromData( PdxReaderPtr input ) = 0;
00050 
00059   virtual int8_t typeId( ) const;
00060 
00062   virtual bool operator==( const CacheableKey& other ) const;
00063 
00065   virtual uint32_t hashcode( ) const;
00066 
00070   virtual void toData( DataOutput& output ) const;
00071 
00076   virtual Serializable* fromData( DataInput& input );
00077 
00083   virtual int32_t classId( ) const { return 0x10; }
00084 
00094   virtual CacheableStringPtr toString() const;
00095 
00099   virtual const char* getClassName()const = 0;
00100 };
00101 }
00102 
00103 #endif /* PDXSERIALIZABLE_HPP_ */

GemFire C++ Cache API Documentation