00001 // ===================================================================== 00002 // $Id: TDataSection.hh,v 1.3 2003/08/25 09:20:29 goiwai Exp $ 00003 // $Name: CLDAQ-1-08-02 $ 00004 // 00005 // $Log: TDataSection.hh,v $ 00006 // Revision 1.3 2003/08/25 09:20:29 goiwai 00007 // operator[]( const Tstring& id ) を加えました. 00008 // record[0] とか record["tag"] とかすれば, TDataSegment を得ることが出来 00009 // ます. 00010 // size()を越えた範囲にも,チェックしないでアクセスします. 00011 // マッチしなかった場合は落ちます. 00012 // 同じ名前でタグされた DataSegment がある場合,最初にマッチしたものが返っ 00013 // てきます. 00014 // 00015 // Revision 1.2 2003/07/30 16:17:51 goiwai 00016 // ファイルにコミットログをつけることにしました. 00017 // 00018 // ===================================================================== 00019 #ifndef __TDATASECTION_HH 00020 #define __TDATASECTION_HH 00021 00022 #include "Tglobals.h" 00023 #include "TStreamableObject.hh" 00024 #include "TDataSegmentList.hh" 00025 00026 class TOutputObjectStream; 00027 class TOutputObjectFile; 00028 class TOutputObjectSocket; 00029 class TOutputObjectSharedMemory; 00030 00031 class TDataSection 00032 : public TStreamableObject, public TDataSegmentList 00033 { 00034 00035 public: 00036 TDataSection( const Tstring& id = TunknownID ); 00037 TDataSection( const TDataSection& right ); 00038 ~TDataSection(); 00039 00040 public: 00041 Tint GetRecordSize(); 00042 Tint Record( TOutputObjectStream* objectfile ); 00043 Tvoid Clear(); 00044 Tint Serialize( Tvoid* buffer ); 00045 00046 public: 00047 const TDataSection& operator=( const TDataSection& right ); 00048 Tbool operator==( const TDataSection& right ) const; 00049 Tbool operator!=( const TDataSection& right ) const; 00050 const TDataSegment& operator[]( Tint n ) const; 00051 TDataSegment& operator[]( Tint n ); 00052 const TDataSegment& operator[]( const Tstring& id ) const; 00053 TDataSegment& operator[]( const Tstring& id ); 00054 friend Tostream& operator<<( Tostream& tos, const TDataSection& right ); 00055 00056 public: 00057 Tbool FindDataSegment( const Tstring& id, TDataSegment& segment ) const; 00058 Tint FindDataSegment( const Tstring& id ) const; 00059 Tbool FindDataElement( const Tstring& segid, const Tstring& eleid, TDataElement& element ) const; 00060 Tint FindDataElement( const Tstring& segid, const Tstring& eleid ) const; 00061 Tbool FindDataElement( Tstring idset[ 2 ], TDataElement& element ) const; 00062 Tint FindDataElement( Tstring idset[ 2 ] ) const; 00063 Tbool FindDataElement( const TstringList& idset, TDataElement& element ) const; 00064 Tint FindDataElement( const TstringList& idset ) const; 00065 00066 private: 00067 Tint record( TOutputObjectFile* ofile ); 00068 Tint record( TOutputObjectSocket* osocket ); 00069 Tint record( TOutputObjectSharedMemory* omemory ); 00070 00071 }; 00072 00073 #endif