00001 // ===================================================================== 00002 // $Id: TSoftwareDataFileModule.hh,v 1.2 2003/07/30 16:19:11 goiwai Exp $ 00003 // $Name: CLDAQ-1-07-01 $ 00004 // 00005 // $Log: TSoftwareDataFileModule.hh,v $ 00006 // Revision 1.2 2003/07/30 16:19:11 goiwai 00007 // ファイルにコミットログをつけることにしました. 00008 // 00009 // ===================================================================== 00010 #ifndef __TSOFTWAREDATAFILEMODULE_HH 00011 #define __TSOFTWAREDATAFILEMODULE_HH 00012 00013 #include "Tglobals.h" 00014 #include "TSoftwareModule.hh" 00015 00016 class TDataSegment; 00017 class TDataElement; 00018 00019 class TSoftwareDataFileModule 00020 : public TSoftwareModule 00021 { 00022 00023 private: 00024 enum { tDefaultBufferLength = 1048576 }; 00025 00026 private: 00027 Tstring theFileName; 00028 Tstring theSeparater; 00029 TdoubleList theChannel; 00030 Tint theBufferLength; 00031 Tint theNumberOfLine; 00032 TstringList theCommentStringList; 00033 Tifstream theInputFileStream; 00034 00035 public: 00036 TSoftwareDataFileModule( const Tstring& filename, Tint nchannel ); 00037 TSoftwareDataFileModule( const Tstring& filename, const TstringList& comment, Tint nchannel ); 00038 TSoftwareDataFileModule( const Tstring& filename, const Tstring& separater, Tint nchannel ); 00039 TSoftwareDataFileModule( const Tstring& filename, const TstringList& comment, const Tstring& separater, Tint nchannel ); 00040 TSoftwareDataFileModule( const TSoftwareDataFileModule& right ); 00041 ~TSoftwareDataFileModule(); 00042 00043 public: 00044 Tint Clear(); 00045 Tint Update(); 00046 Tint Initialize(); 00047 00048 public: 00049 Tvoid FillData( TDataElement& element, Tint channel ); 00050 00051 public: 00052 const TSoftwareDataFileModule& operator=( const TSoftwareDataFileModule& right ); 00053 Tbool operator==( const TSoftwareDataFileModule& right ) const; 00054 Tbool operator!=( const TSoftwareDataFileModule& right ) const; 00055 00056 public: 00057 const Tstring& GetFileName() const; 00058 const Tstring& GetSeparater() const; 00059 const TdoubleList& GetChannel() const; 00060 Tint GetBufferLength() const; 00061 const TstringList& GetCommentStringList() const; 00062 Tint GetNumberOfLine() const; 00063 Tifstream& GetInputFileStream(); 00064 Tvoid SetFileName( const Tstring& fname ); 00065 Tvoid SetSeparater( const Tstring& separater ); 00066 Tvoid SetChannel( const TdoubleList& channels ); 00067 Tvoid SetBufferLength( Tint buflen ); 00068 Tvoid SetCommentStringList( const TstringList& commentlist ); 00069 Tvoid SetNumberOfLine( Tint nline ); 00070 00071 private: 00072 const Tstring& eraseComment( Tstring& readline ) const; 00073 TdoubleList divideLine( Tstring readline ) const; 00074 Tint getNumberOfLine() const; 00075 00076 }; 00077 00078 inline const Tstring& TSoftwareDataFileModule::GetFileName() const 00079 { 00080 return( theFileName ); 00081 } 00082 00083 inline const Tstring& TSoftwareDataFileModule::GetSeparater() const 00084 { 00085 return( theSeparater ); 00086 } 00087 00088 inline const TdoubleList& TSoftwareDataFileModule::GetChannel() const 00089 { 00090 return( theChannel ); 00091 } 00092 00093 inline Tint TSoftwareDataFileModule::GetBufferLength() const 00094 { 00095 return( theBufferLength ); 00096 } 00097 00098 inline const TstringList& TSoftwareDataFileModule::GetCommentStringList() const 00099 { 00100 return( theCommentStringList ); 00101 } 00102 00103 inline Tint TSoftwareDataFileModule::GetNumberOfLine() const 00104 { 00105 return( theNumberOfLine ); 00106 } 00107 00108 inline Tifstream& TSoftwareDataFileModule::GetInputFileStream() 00109 { 00110 return( theInputFileStream ); 00111 } 00112 00113 inline Tvoid TSoftwareDataFileModule::SetFileName( const Tstring& fname ) 00114 { 00115 theFileName = fname; 00116 return; 00117 } 00118 00119 inline Tvoid TSoftwareDataFileModule::SetSeparater( const Tstring& separater ) 00120 { 00121 theSeparater = separater; 00122 return; 00123 } 00124 00125 inline Tvoid TSoftwareDataFileModule::SetChannel( const TdoubleList& channels ) 00126 { 00127 theChannel = channels; 00128 return; 00129 } 00130 00131 inline Tvoid TSoftwareDataFileModule::SetBufferLength( Tint buflen ) 00132 { 00133 theBufferLength = buflen; 00134 return; 00135 } 00136 00137 inline Tvoid TSoftwareDataFileModule::SetCommentStringList( const TstringList& commentlist ) 00138 { 00139 theCommentStringList = commentlist; 00140 return; 00141 } 00142 00143 inline Tvoid TSoftwareDataFileModule::SetNumberOfLine( Tint nline ) 00144 { 00145 theNumberOfLine = nline; 00146 return; 00147 } 00148 00149 #endif