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