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