00001
00028
00029 #ifndef CLDAQ__TSOFTWAREDATAFILEMODULE_HH
00030 #define CLDAQ__TSOFTWAREDATAFILEMODULE_HH
00031
00032 #include "Tglobals.h"
00033 #include "TSoftwareModule.hh"
00034
00035 class TDataSegment;
00036 class TDataElement;
00037
00038
00058 class TSoftwareDataFileModule
00059 : public TSoftwareModule
00060 {
00061
00062 private:
00063 enum { tDefaultBufferLength = 1048576 };
00064
00065 private:
00066 Tstring theFileName;
00067 Tstring theSeparater;
00068 TdoubleList theChannel;
00069 Tint theBufferLength;
00070 Tint theNumberOfLine;
00071 TstringList theCommentStringList;
00072 Tifstream theInputFileStream;
00073
00074 public:
00075 TSoftwareDataFileModule( const Tstring& filename, Tint nchannel );
00076 TSoftwareDataFileModule( const Tstring& filename, const TstringList& comment, Tint nchannel );
00077 TSoftwareDataFileModule( const Tstring& filename, const Tstring& separater, Tint nchannel );
00078 TSoftwareDataFileModule( const Tstring& filename, const TstringList& comment, const Tstring& separater, Tint nchannel );
00079 TSoftwareDataFileModule( const TSoftwareDataFileModule& right );
00080 ~TSoftwareDataFileModule();
00081
00082 public:
00083 Tint Clear();
00084 Tint Update();
00085 Tint Initialize();
00086
00087 public:
00088 Tvoid FillData( TDataElement& element, Tint channel );
00089
00090 public:
00091 const TSoftwareDataFileModule& operator=( const TSoftwareDataFileModule& right );
00092 Tbool operator==( const TSoftwareDataFileModule& right ) const;
00093 Tbool operator!=( const TSoftwareDataFileModule& right ) const;
00094
00095 public:
00096 const Tstring& GetFileName() const;
00097 const Tstring& GetSeparater() const;
00098 const TdoubleList& GetChannel() const;
00099 Tint GetBufferLength() const;
00100 const TstringList& GetCommentStringList() const;
00101 Tint GetNumberOfLine() const;
00102 Tifstream& GetInputFileStream();
00103 Tvoid SetFileName( const Tstring& fname );
00104 Tvoid SetSeparater( const Tstring& separater );
00105 Tvoid SetChannel( const TdoubleList& channels );
00106 Tvoid SetBufferLength( Tint buflen );
00107 Tvoid SetCommentStringList( const TstringList& commentlist );
00108 Tvoid SetNumberOfLine( Tint nline );
00109
00110 private:
00111 const Tstring& eraseComment( Tstring& readline ) const;
00112 TdoubleList divideLine( Tstring readline ) const;
00113 Tint getNumberOfLine() const;
00114
00115 #ifdef __CLDAQ_ROOT_DLL
00116 ClassDef(TSoftwareDataFileModule,0)
00117 #endif
00118
00119 };
00120
00121 inline const Tstring& TSoftwareDataFileModule::GetFileName() const
00122 {
00123 return theFileName;
00124 }
00125
00126 inline const Tstring& TSoftwareDataFileModule::GetSeparater() const
00127 {
00128 return theSeparater;
00129 }
00130
00131 inline const TdoubleList& TSoftwareDataFileModule::GetChannel() const
00132 {
00133 return theChannel;
00134 }
00135
00136 inline Tint TSoftwareDataFileModule::GetBufferLength() const
00137 {
00138 return theBufferLength;
00139 }
00140
00141 inline const TstringList& TSoftwareDataFileModule::GetCommentStringList() const
00142 {
00143 return theCommentStringList;
00144 }
00145
00146 inline Tint TSoftwareDataFileModule::GetNumberOfLine() const
00147 {
00148 return theNumberOfLine;
00149 }
00150
00151 inline Tifstream& TSoftwareDataFileModule::GetInputFileStream()
00152 {
00153 return theInputFileStream;
00154 }
00155
00156 inline Tvoid TSoftwareDataFileModule::SetFileName( const Tstring& fname )
00157 {
00158 theFileName = fname;
00159 return;
00160 }
00161
00162 inline Tvoid TSoftwareDataFileModule::SetSeparater( const Tstring& separater )
00163 {
00164 theSeparater = separater;
00165 return;
00166 }
00167
00168 inline Tvoid TSoftwareDataFileModule::SetChannel( const TdoubleList& channels )
00169 {
00170 theChannel = channels;
00171 return;
00172 }
00173
00174 inline Tvoid TSoftwareDataFileModule::SetBufferLength( Tint buflen )
00175 {
00176 theBufferLength = buflen;
00177 return;
00178 }
00179
00180 inline Tvoid TSoftwareDataFileModule::SetCommentStringList( const TstringList& commentlist )
00181 {
00182 theCommentStringList = commentlist;
00183 return;
00184 }
00185
00186 inline Tvoid TSoftwareDataFileModule::SetNumberOfLine( Tint nline )
00187 {
00188 theNumberOfLine = nline;
00189 return;
00190 }
00191
00192 #endif