00001 #ifndef __GEMFIRE_SERIALIZABLE_H__
00002 #define __GEMFIRE_SERIALIZABLE_H__
00003
00004
00005
00006
00007
00008
00013 #include "gfcpp_globals.hpp"
00014 #include "gf_types.hpp"
00015
00016 namespace gemfire
00017 {
00018
00019 class DataOutput;
00020 class DataInput;
00021
00026 typedef Serializable* ( *TypeFactoryMethod ) ();
00027
00034 class CPPCACHE_EXPORT Serializable : public SharedBase
00035 {
00036
00037 public:
00038
00042 virtual void toData( DataOutput& output ) const = 0;
00043
00048 virtual Serializable* fromData( DataInput& input ) = 0;
00049
00060 virtual int8_t classId( ) const = 0;
00061
00070 virtual int8_t typeId( ) const;
00071
00079 virtual uint32_t objectSize() const = 0;
00080
00089 static void registerType( TypeFactoryMethod creationFunction );
00090
00100 virtual CacheableStringPtr toString( ) const;
00101
00107 template< class PRIM >
00108 inline static SerializablePtr create( const PRIM value )
00109 {
00110 return createValue( value );
00111 }
00112
00116 virtual ~Serializable()
00117 {}
00118
00119 protected:
00120
00124 Serializable()
00125 : SharedBase()
00126 {}
00127
00128 private:
00129
00130
00131 Serializable( const Serializable& other );
00132 void operator = ( const Serializable& other );
00133
00134 };
00135
00136 }
00137
00138 #endif //ifndef __GEMFIRE_SERIALIZABLE_H__