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