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