00001 // ===================================================================== 00030 // ===================================================================== 00031 #ifndef __TSTREAMABLEOBJECT_HH 00032 #define __TSTREAMABLEOBJECT_HH 00033 00034 #include "Tglobals.h" 00035 00036 class TOutputObjectStream; 00037 00038 00058 class TStreamableObject 00059 { 00060 00061 protected: 00062 Tobject_t theObjectType; 00063 Tstring theID; 00064 00065 public: 00066 TStreamableObject( Tobject_t objecttype, const Tstring& id ); 00067 TStreamableObject( const TStreamableObject& right ); 00068 00069 public: 00070 Tobject_t GetObjectType() const; 00071 const Tstring& GetID() const; 00072 Tvoid SetObjectType( Tobject_t objecttype ); 00073 Tvoid SetID( const Tstring& id ); 00074 00075 public: 00076 virtual const TStreamableObject& operator=( const TStreamableObject& right ); 00077 virtual Tbool operator==( const TStreamableObject& right ) const; 00078 virtual Tbool operator!=( const TStreamableObject& right ) const; 00079 00080 protected: 00081 virtual ~TStreamableObject(); 00082 00083 public: 00084 virtual Tint GetRecordSize() = 0; 00085 virtual Tint Record( TOutputObjectStream* output ) = 0; 00086 virtual Tvoid Clear() = 0; 00087 virtual Tint Serialize( const Tvoid* buffer ) = 0; 00088 virtual Tint Deserialize( const Tvoid* buffer ) = 0; 00089 virtual Tint Size() const = 0; 00090 00091 }; 00092 00093 inline Tobject_t TStreamableObject::GetObjectType() const 00094 { 00095 return theObjectType; 00096 } 00097 00098 inline const Tstring& TStreamableObject::GetID() const 00099 { 00100 return theID; 00101 } 00102 00103 inline Tvoid TStreamableObject::SetObjectType( Tobject_t objecttype ) 00104 { 00105 theObjectType = objecttype; 00106 return; 00107 } 00108 00109 inline Tvoid TStreamableObject::SetID( const Tstring& id ) 00110 { 00111 theID = id; 00112 return; 00113 } 00114 00115 #endif