Commit df9f69cf 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: 2612
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 0881da7e
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.35 2007-12-07 08:14:40 tforb Exp $
# $Id: Makefile,v 1.36 2008-07-08 13:37:08 tforb Exp $
#
# Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach)
#
......@@ -29,6 +29,7 @@
# 30/03/2004 V1.0 Thomas Forbriger
# 29/06/2007 V1.1 included SAC binary reading
# 19/09/2007 V1.2 included raw GSE reading
# 08/07/2008 V1.3 started tracereader
#
# ============================================================================
#
......@@ -38,7 +39,7 @@ HEADERS=datread.h bonjer.h bonjer/readbonjer.h readany.h error.h \
pdas.h pdas/pdasread.h pdas/pdasflags.h mseed/seedstructdump.h \
sff.h mseed.h mseed/mseedread.h mseed/seedstructs.h \
hpmo.h hpmo/readhpmo.h hpmo/hpmodata.h util.h sac.h sac/sacread.h \
bytesex.h debug.h gse.h gse/gseread.h
bytesex.h debug.h gse.h gse/gseread.h tracereader.h
#SRC=misc/fortranio.cc misc/commandline.cc misc/ioswap.cc misc/error.cc \
# misc/blitzfortranio.cc hacks/hack_blitztogrepg.cc
......@@ -47,7 +48,8 @@ LIBSRC=datread.cc bonjer/bonjer.cc bonjer/readbonjer.cc readany.cc error.cc \
pdas/pdas.cc pdas/pdasread.cc mseed/seedstructdump.cc \
sff/sff.cc mseed/mseedread.cc mseed/mseed.cc mseed/seedstructs.cc \
hpmo/hpmo.cc hpmo/readhpmo.cc hpmo/hpmodata.cc \
util.cc sac/sac.cc sac/sacread.cc bytesex.cc gse/gseread.cc gse/gse.cc
util.cc sac/sac.cc sac/sacread.cc bytesex.cc gse/gseread.cc gse/gse.cc \
tracereader.cc
TESTSRC=tests/hpmotest.cc tests/pdastest.cc tests/mseedtest.cc \
tests/sfftest.cc tests/sactest.cc
......
/*! \file tracereader.cc
* \brief provide more efficient reading of sequential traces (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: tracereader.cc,v 1.1 2008-07-08 13:37:08 tforb Exp $
* \author Thomas Forbriger
* \date 08/07/2008
*
* provide more efficient reading of sequential traces (implementation)
*
* Copyright (c) 2008 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 08/07/2008 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define DATREAD_TRACEREADER_CC_VERSION \
"DATREAD_TRACEREADER_CC V1.0 "
#define DATREAD_TRACEREADER_CC_CVSID \
"$Id: tracereader.cc,v 1.1 2008-07-08 13:37:08 tforb Exp $"
#include <datreadxx/tracereader.h>
#include <datreadxx/error.h>
namespace datread {
sequentialtracereader::~sequentialtracereader()
{
if (this->Mopen)
{
delete MPis;
delete MPias;
}
} // sequentialtracereader::~sequentialtracereader()
/*----------------------------------------------------------------------*/
datread::ianystream& sequentialtracereader::ianystream()
{
DATREAD_assert(Mopen, "sequentialtracereader::idatstream(): "
"no file is open!");
return (*MPias);
} // datread::ianystream& sequentialtracereader::ianystream()
/*----------------------------------------------------------------------*/
bool sequentialtracereader::select(const std::string& filename,
const int& itrace,
const Eformat& format)
{
bool doopen=false;
// check: must a new file be opened?
if (!Mopen)
{
doopen=true;
}
else
{
if (filename != Mfilename) { doopen=true; }
else if (itrace < Mindex) { doopen=true; }
}
// if yes: open new file
if (doopen)
{
if (this->Mopen)
{
delete MPis;
delete MPias;
}
Mindex=1;
Mfilename=filename;
MPis=new std::ifstream(Mfilename.c_str());
MPias=new datread::ianystream(*MPis, format);
Mopen=true;
}
// skip to selected trace
int nskip=itrace-Mindex;
for (int iskip=0; iskip<nskip; ++iskip)
{
DATREAD_assert(MPias->good(), "sequentialtracereader::select: "
"input is not good!");
MPias->skipseries();
++Mindex;
}
} // sequentialtracereader::select
} // namespace datread
/* ----- END OF tracereader.cc ----- */
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