Commit eed7508d authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2887
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent ad4619f2
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsofttest.cc,v 1.10 2009-11-11 16:21:45 tforb Exp $
* $Id: tsofttest.cc,v 1.11 2009-11-11 18:07:07 tforb Exp $
* \author Thomas Forbriger
* \date 17/09/2009
*
......@@ -35,7 +35,7 @@
#define TSOFTTEST_VERSION \
"TSOFTTEST V1.0 test tsoft reading"
#define TSOFTTEST_CVSID \
"$Id: tsofttest.cc,v 1.10 2009-11-11 16:21:45 tforb Exp $"
"$Id: tsofttest.cc,v 1.11 2009-11-11 18:07:07 tforb Exp $"
#include <iostream>
#include <fstream>
......@@ -44,6 +44,7 @@
#include <datreadxx/tsoftdata.h>
#include <datreadxx/tsoftreader.h>
#include <datreadxx/channeltranslation.h>
#include <datreadxx/tsoft.h>
using std::cout;
using std::cerr;
......@@ -52,7 +53,7 @@ using std::endl;
/*----------------------------------------------------------------------*/
struct Options {
bool verbose, test1, test2, test3, debug, ttest;
bool verbose, test1, test2, test3, debug, ttest, stest;
}; // struct Options
/*----------------------------------------------------------------------*/
......@@ -64,7 +65,7 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
TSOFTTEST_VERSION "\n"
"usage: tsofttest file [-t1] [-t2] [-t3] [-t4] [-v] [-D]" "\n"
"usage: tsofttest file [-t1] [-t2] [-t3] [-t4] [-t5] [-v] [-D]" "\n"
" or: tsofttest --help|-h" "\n"
};
......@@ -80,6 +81,7 @@ int main(int iargc, char* argv[])
"-t2 test trimws" "\n"
"-t3 test class tsoftfile" "\n"
"-t4 test translation table" "\n"
"-t5 test itsoftstream" "\n"
};
// define commandline options
......@@ -100,6 +102,8 @@ int main(int iargc, char* argv[])
{"D",arg_no,"-"},
// 6: test translation table
{"t4",arg_no,"-"},
// 7: test translation table
{"t5",arg_no,"-"},
{NULL}
};
......@@ -128,6 +132,7 @@ int main(int iargc, char* argv[])
opt.test3=cmdline.optset(4);
opt.debug=cmdline.optset(5);
opt.ttest=cmdline.optset(6);
opt.stest=cmdline.optset(7);
/*
// dummy operation: print option settings
......@@ -296,6 +301,35 @@ int main(int iargc, char* argv[])
}
}
// end of t test
/*======================================================================*/
// s test
if (opt.stest)
{
if (opt.verbose)
{ cout << "stest: itsoftstream" << endl; }
std::ifstream is(filename.c_str());
datread::itsoftstream its(is);
cout << its.free();
while (its.good())
{
datread::Tdseries series=its.dseries();
sff::WID2 wid2=its.wid2();
sff::FREE free=its.free();
cout << endl;
cout << "WID2 line of next trace:" << endl;
cout << wid2.line();
cout << "FREE block of next trace:" << endl;
cout << free;
cout << "some samples of of next trace:" << endl;
int nsa=series.size() < 10 ? series.size() : 10;
for (int isa=0; isa<nsa; ++isa)
{
cout << series(isa+series.f()) << endl;
}
}
}
// end of s test
}
/* ----- END OF tsofttest.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: channeltranslation.cc,v 1.2 2009-11-11 17:41:22 tforb Exp $
* $Id: channeltranslation.cc,v 1.3 2009-11-11 18:07:07 tforb Exp $
* \author Thomas Forbriger
* \date 11/11/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_CHANNELTRANSLATION_CC_VERSION \
"DATREAD_CHANNELTRANSLATION_CC V1.0 "
#define DATREAD_CHANNELTRANSLATION_CC_CVSID \
"$Id: channeltranslation.cc,v 1.2 2009-11-11 17:41:22 tforb Exp $"
"$Id: channeltranslation.cc,v 1.3 2009-11-11 18:07:07 tforb Exp $"
#include <iomanip>
#include <datreadxx/error.h>
......@@ -252,6 +252,10 @@ namespace datread {
SFFchannelid translate(const TSOFTchannelid& ci)
{
std::cout << "translate: "
<< ci.location << ":"
<< ci.instrument << ":"
<< ci.datatype << ":" << std::endl;
SFFchannelid retval;
retval.station=NSP;
retval.channel=NSP;
......@@ -267,6 +271,10 @@ namespace datread {
&& (tci.instrument==ci.instrument)
&& (tci.datatype==ci.datatype))
{
std::cout << "found: "
<< tci.location << ":"
<< tci.instrument << ":"
<< tci.datatype << ":" << std::endl;
SFFchannelid sci=schannelid(*pc);
retval.station=sci.station;
retval.channel=sci.channel;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftdata.cc,v 1.10 2009-11-11 09:17:08 tforb Exp $
* $Id: tsoftdata.cc,v 1.11 2009-11-11 18:07:07 tforb Exp $
* \author Thomas Forbriger
* \date 16/09/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_TSOFTDATA_CC_VERSION \
"DATREAD_TSOFTDATA_CC V1.0 "
#define DATREAD_TSOFTDATA_CC_CVSID \
"$Id: tsoftdata.cc,v 1.10 2009-11-11 09:17:08 tforb Exp $"
"$Id: tsoftdata.cc,v 1.11 2009-11-11 18:07:07 tforb Exp $"
#include <datreadxx/error.h>
#include <datreadxx/tsoftdata.h>
......@@ -86,7 +86,7 @@ namespace datread {
if (j <len)
{
Mhascontent=true;
Mcontent=line.substr(j,len-j);
Mcontent=trimws(line.substr(j,len-j+1));
}
}
}
......@@ -111,6 +111,7 @@ namespace datread {
if (I != vos.end()) { Mlocation = *I; ++I; }
if (I != vos.end()) { Minstrument = *I; ++I; }
if (I != vos.end()) { Mdatatype = *I; ++I; }
std::cout << "+++" << Mdatatype << "+++" << std::endl;
} // Channelinfo::setchannelinfo(const std::string& line)
/*======================================================================*/
......@@ -301,7 +302,7 @@ namespace datread {
string::size_type ib=line.find_first_not_of(" ", 0);
string::size_type il=line.find_last_not_of(" ", line.length());
il=il<ib ? ib : il;
return (line.substr(ib,il-ib));
return (line.substr(ib,il-ib+1));
} // std::string trimws(const std::string& line)
/*----------------------------------------------------------------------*/
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftreader.cc,v 1.9 2009-11-11 09:17:08 tforb Exp $
* $Id: tsoftreader.cc,v 1.10 2009-11-11 18:07:07 tforb Exp $
* \author Thomas Forbriger
* \date 16/09/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_TSOFTREADER_CC_VERSION \
"DATREAD_TSOFTREADER_CC V1.0 "
#define DATREAD_TSOFTREADER_CC_CVSID \
"$Id: tsoftreader.cc,v 1.9 2009-11-11 09:17:08 tforb Exp $"
"$Id: tsoftreader.cc,v 1.10 2009-11-11 18:07:07 tforb Exp $"
#include <iostream>
#include <sstream>
......@@ -102,6 +102,8 @@ namespace datread {
bool inunits=false;
std::string inputline;
getline(is, inputline);
// check for DOS file
inputline.replace(inputline.find("\r"), 1, "");
while (is.good())
{
int linelength=datread::tsoft::trimws(inputline).length();
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftsffcontainer.cc,v 1.2 2009-11-11 17:41:22 tforb Exp $
* $Id: tsoftsffcontainer.cc,v 1.3 2009-11-11 18:07:07 tforb Exp $
* \author Thomas Forbriger
* \date 11/11/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_TSOFTSFFCONTAINER_CC_VERSION \
"DATREAD_TSOFTSFFCONTAINER_CC V1.0 "
#define DATREAD_TSOFTSFFCONTAINER_CC_CVSID \
"$Id: tsoftsffcontainer.cc,v 1.2 2009-11-11 17:41:22 tforb Exp $"
"$Id: tsoftsffcontainer.cc,v 1.3 2009-11-11 18:07:07 tforb Exp $"
#include <datreadxx/tsoftsffcontainer.h>
#include <datreadxx/tsoftreader.h>
......@@ -95,6 +95,10 @@ namespace datread {
tci.location=ci.thelocation();
tci.instrument=ci.theinstrument();
tci.datatype=ci.thedatatype();
std::cout << "translate: "
<< tci.location << ":"
<< tci.instrument << ":"
<< tci.datatype << ":" << std::endl;
SFFchannelid sci=translate(tci);
I->Mwid2.station=sci.station;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment