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