00001 #ifndef __GEMFIRE_SERIALIZABLE_H__
00002 #define __GEMFIRE_SERIALIZABLE_H__
00003
00004
00005
00006
00007
00008
00009
00010
00015 #include "gfcpp_globals.hpp"
00016 #include "gf_types.hpp"
00017
00018 namespace gemfire
00019 {
00020
00021 class DataOutput;
00022 class DataInput;
00023
00024 typedef void ( *CliCallbackMethod) ();
00025
00030 typedef Serializable* ( *TypeFactoryMethod ) ();
00031
00032 typedef PdxSerializable* ( *TypeFactoryMethodPdx ) ();
00039 class CPPCACHE_EXPORT Serializable : public SharedBase
00040 {
00041
00042 public:
00043
00047 virtual void toData( DataOutput& output ) const = 0;
00048
00053 virtual Serializable* fromData( DataInput& input ) = 0;
00054
00063 virtual int32_t classId( ) const = 0;
00064
00073 virtual int8_t typeId( ) const;
00074
00082 virtual int8_t DSFID( ) const;
00083
00092 virtual uint32_t objectSize() const;
00093
00102 static void registerType( TypeFactoryMethod creationFunction );
00103
00110 static void registerPdxType( TypeFactoryMethodPdx creationFunction );
00111
00116 static void registerPdxSerializer( PdxSerializerPtr pdxSerializer );
00117
00127 virtual CacheableStringPtr toString( ) const;
00128
00134 template< class PRIM >
00135 inline static SerializablePtr create( const PRIM value );
00136
00140 virtual ~Serializable()
00141 {}
00142
00143 protected:
00144
00148 Serializable()
00149 : SharedBase()
00150 {}
00151
00152 private:
00153
00154
00155 Serializable( const Serializable& other );
00156 void operator = ( const Serializable& other );
00157
00158 };
00159
00160 }
00161
00162 #endif //ifndef __GEMFIRE_SERIALIZABLE_H__