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
00058 virtual int32_t classId( ) const = 0;
00059
00068 virtual int8_t typeId( ) const;
00069
00077 virtual int8_t DSFID( ) const;
00078
00086 virtual uint32_t objectSize() const = 0;
00087
00096 static void registerType( TypeFactoryMethod creationFunction );
00097
00107 virtual CacheableStringPtr toString( ) const;
00108
00114 template< class PRIM >
00115 inline static SerializablePtr create( const PRIM value )
00116 {
00117 return createValue( value );
00118 }
00119
00123 virtual ~Serializable()
00124 {}
00125
00126 protected:
00127
00131 Serializable()
00132 : SharedBase()
00133 {}
00134
00135 private:
00136
00137
00138 Serializable( const Serializable& other );
00139 void operator = ( const Serializable& other );
00140
00141 };
00142
00143 }
00144
00145 #endif //ifndef __GEMFIRE_SERIALIZABLE_H__