00001 // ===================================================================== 00047 // ===================================================================== 00048 #ifndef __TDATASEGMENT_HH 00049 #define __TDATASEGMENT_HH 00050 00051 #include "Tglobals.h" 00052 #include "TStreamableObject.hh" 00053 #include "TDataElementList.hh" 00054 00055 class TOutputObjectStream; 00056 class TOutputObjectFile; 00057 class TOutputObjectSocket; 00058 class TOutputObjectSharedMemory; 00059 00060 00080 class TDataSegment 00081 : public TStreamableObject, public TDataElementList 00082 { 00083 00084 public: 00085 TDataSegment( const Tstring& id = TunknownID ); 00086 TDataSegment( const TDataSegment& right ); 00087 ~TDataSegment(); 00088 00089 public: 00090 Tint GetRecordSize(); 00091 Tint Record( TOutputObjectStream* output ); 00092 Tvoid Clear(); 00093 Tint Serialize( const Tvoid* buffer ); 00094 Tint Deserialize( const Tvoid* buffer ); 00095 Tint Size() const; 00096 00097 public: 00098 const TDataSegment& operator=( const TDataSegment& right ); 00099 Tbool operator==( const TDataSegment& right ) const; 00100 Tbool operator!=( const TDataSegment& right ) const; 00101 Tbool operator==( const Tstring& right ) const; 00102 Tbool operator!=( const Tstring& right ) const; 00103 const TDataElement& operator[]( Tint n ) const; 00104 TDataElement& operator[]( Tint n ); 00105 const TDataElement& operator[]( const Tstring& id ) const; 00106 TDataElement& operator[]( const Tstring& id ); 00107 friend Tostream& operator<<( Tostream& tos, const TDataSegment& right ); 00108 00109 public: 00110 Tbool FindDataElement( const Tstring& id, TDataElement& element ) const; 00111 Tint FindDataElement( const Tstring& id ) const; 00112 00113 private: 00114 Tint record( TOutputObjectFile* ofile ); 00115 Tint record( TOutputObjectSocket* osocket ); 00116 Tint record( TOutputObjectSharedMemory* omemory ); 00117 00118 }; 00119 00120 inline Tint TDataSegment::Size() const 00121 { 00122 return (Tint)size(); 00123 } 00124 00125 #endif