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

new test

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: 2107
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 9b17ab96
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mseedtest.cc,v 1.15 2006-04-04 16:29:24 tforb Exp $
* $Id: mseedtest.cc,v 1.16 2006-05-03 12:09:28 tforb Exp $
* \author Thomas Forbriger
* \date 15/07/2004
*
......@@ -36,7 +36,7 @@
#define MSEEDTEST_VERSION \
"MSEEDTEST V1.1 test mini-SEED reading"
#define MSEEDTEST_CVSID \
"$Id: mseedtest.cc,v 1.15 2006-04-04 16:29:24 tforb Exp $"
"$Id: mseedtest.cc,v 1.16 2006-05-03 12:09:28 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -58,7 +58,7 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
MSEEDTEST_VERSION "\n"
"usage: mseedtest [-v] [-raw] [-reader] [-skip]" "\n"
"usage: mseedtest [-v] [-raw] [-reader] [-skip] [-stream]" "\n"
" file [file...]" "\n"
" or: mseedtest --help|-h" "\n"
};
......@@ -71,6 +71,7 @@ int main(int iargc, char* argv[])
"-raw use raw reading functions from mseedstruct" "\n"
"-reader use reading functions from mseedread" "\n"
"-skip skip data samples" "\n"
"-stream read data through stream" "\n"
};
// define commandline options
......@@ -87,6 +88,8 @@ int main(int iargc, char* argv[])
{"reader",arg_no,"-"},
// 4: skip mode
{"skip",arg_no,"-"},
// 5: stream mode
{"stream",arg_no,"-"},
{NULL}
};
......@@ -132,6 +135,7 @@ int main(int iargc, char* argv[])
bool rawmode=cmdline.optset(2);
bool readermode=cmdline.optset(3);
bool skipmode=cmdline.optset(4);
bool streammode=cmdline.optset(5);
if (verbosemode) { cout << "in verbose modes" << endl; }
......@@ -384,6 +388,64 @@ int main(int iargc, char* argv[])
}
}
} // end reader mode
/*======================================================================*/
if (streammode)
{
cout << endl;
cout << "stream mode" << endl;
cout << "===========" << endl;
std::ifstream ifs(filename.c_str());
datread::imseedstream is(ifs, verbosemode);
int itrace=0;
while (ifs.good() && is.good() && (!is.last()))
{
datread::Tiseries series;
if (skipmode) { is.skipseries(); }
else { is >> series; }
++itrace;
cout << endl;
cout << "TRACE #" << itrace << endl;
cout << "=========" << endl;
if (is.last())
{ cout << "(is the last trace in the file)" << endl; }
sff::WID2 wid2line;
is >> wid2line;
cout << wid2line.line() << endl;
if (skipmode)
{
cout << "data samples were skipped" << endl;
}
else
{
cout << "series contains " << series.size()
<< " samples" << endl;
cout << "first (" << series.f() << ") sample: "
<< series(series.f()) << endl;
cout << "last (" << series.l() << ") sample: "
<< series(series.l()) << endl;
}
if (is.hasinfo())
{
sff::INFO infoline;
is >> infoline;
cout << infoline.line() << endl;;
}
if (is.hasfree())
{
sff::FREE freeblock;
is >> freeblock;
cout << freeblock;
}
}
} // end stream mode
}
}
......
Markdown is supported
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