Commit bdb34584 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: 2114
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 999678da
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mseedread.cc,v 1.18 2006-04-28 10:06:21 tforb Exp $
* $Id: mseedread.cc,v 1.19 2006-05-09 17:04:02 tforb Exp $
* \author Thomas Forbriger
* \date 15/07/2004
*
......@@ -34,13 +34,14 @@
* - 28/04/2006 V1.2 - long int appears to be of
* implementation dependent size
* - provide explicit conversion of BTIME fields
* - 09/05/2006 V1.3 use general Steim 1 and 2 code
*
* ============================================================================
*/
#define TF_MSEEDREAD_CC_VERSION \
"TF_MSEEDREAD_CC V1.2"
"TF_MSEEDREAD_CC V1.3"
#define TF_MSEEDREAD_CC_CVSID \
"$Id: mseedread.cc,v 1.18 2006-04-28 10:06:21 tforb Exp $"
"$Id: mseedread.cc,v 1.19 2006-05-09 17:04:02 tforb Exp $"
#include <string>
#include <string.h>
......@@ -257,7 +258,7 @@ namespace datread {
// number of blocks to read for full record
int nblocks=reclen/block.bytesize();
// number of frames to be expected
int nframes=(reclen-pdata)/SEED::Steim1Frame::blocksize;
int nframes=(reclen-pdata)/SEED::SteimFrame::blocksize;
// is number of frames read from file?
bool filetellsnframes=false;
if (Mhasblockette1001)
......@@ -266,9 +267,10 @@ namespace datread {
nframes=Mblockette1001.ifcount();
}
// check Steim 1 encoding
DATREAD_assert((Mblockette1000.iformat() == SEED::steim1),
DATREAD_assert(((Mblockette1000.iformat() == SEED::steim1) ||
(Mblockette1000.iformat() == SEED::steim2)),
"ERROR (reading MiniSEED record): "
"Can only decode Steim (1) compression");
"Can only decode Steim (1) or Steim (2) compression");
// check size of sample buffer
if (int(Mdata.size())<nsamples)
{ Mdata=Tseries(nsamples); }
......@@ -285,15 +287,27 @@ namespace datread {
// extract
while (pdata < int(block.bytesize()))
{
SEED::Steim1Frame frame(block.block(pdata), doswap);
SEED::Steim1Reader rframe(frame);
SEED::SteimFrame* pframe;
switch (Mblockette1000.iformat())
{
case SEED::steim1:
pframe= new SEED::Steim1Frame(block.block(pdata), doswap);
break;
case SEED::steim2:
pframe= new SEED::Steim2Frame(block.block(pdata), doswap);
break;
default:
DATREAD_abort("ERROR (reading MiniSEED record): "
"compression format not supported");
}
SEED::SteimReader& rframe(*pframe);
if (waitingforxn) {
DATREAD_assert((rframe.ctrl()==SEED::Steim1Frame::Fspecial),
DATREAD_assert((rframe.ctrl()==SEED::SteimFrame::Fspecial),
"ERROR (reading MiniSEED record): "
"missing X0");
x0=rframe.diff();
rframe.next();
DATREAD_assert((rframe.ctrl()==SEED::Steim1Frame::Fspecial),
DATREAD_assert((rframe.ctrl()==SEED::SteimFrame::Fspecial),
"ERROR (reading MiniSEED record): "
"missing XN");
xn=rframe.diff();
......@@ -313,7 +327,8 @@ namespace datread {
++isample;
rframe.next();
}
pdata += SEED::Steim1Frame::blocksize;
pdata += SEED::SteimFrame::blocksize;
delete pframe;
}
// read next block
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructdump.cc,v 1.11 2006-04-04 10:02:57 tforb Exp $
* $Id: seedstructdump.cc,v 1.12 2006-05-09 17:04:02 tforb Exp $
* \author Thomas Forbriger
* \date 15/03/2006
*
......@@ -35,7 +35,7 @@
#define TF_SEEDSTRUCTDUMP_CC_VERSION \
"TF_SEEDSTRUCTDUMP_CC V1.0 "
#define TF_SEEDSTRUCTDUMP_CC_CVSID \
"$Id: seedstructdump.cc,v 1.11 2006-04-04 10:02:57 tforb Exp $"
"$Id: seedstructdump.cc,v 1.12 2006-05-09 17:04:02 tforb Exp $"
#include<string>
#include<iomanip>
......@@ -337,7 +337,7 @@ namespace datread {
// os.setf(std::ios_base::showbase);
os.width(8);
os.fill('0');
os << f.control;
os << f.control();
os.flags(flags);
os << std::endl;
/*
......@@ -350,15 +350,17 @@ namespace datread {
}
*/
os << " data: " << std::endl;
for (int i=0; i<Steim1Frame::nelements; ++i)
for (int i=0; i<Steim1Frame::nwords; ++i)
{
Steim1Word w;
w.fw=f.word(i);
switch (f.ctrl(i)) {
case Steim1Frame::Fspecial:
os << " #";
os.width(2);
os.fill('0');
os << i << " special (" << f.ctrl(i) << "): "
<< f.w[i].fw << std::endl;
<< w.fw << std::endl;
break;
case Steim1Frame::Fbyte:
for (int j=0; j<4; ++j)
......@@ -367,7 +369,7 @@ namespace datread {
os.width(2);
os.fill('0');
os << i << " byte (" << f.ctrl(i) << ") #" << j << ": "
<< int(f.w[i].byte[j]) << std::endl;
<< int(w.byte[j]) << std::endl;
}
break;
case Steim1Frame::Fhw:
......@@ -377,7 +379,7 @@ namespace datread {
os.width(2);
os.fill('0');
os << i << " halfword (" << f.ctrl(i) << ") #" << j << ": "
<< f.w[i].hw[j] << std::endl;
<< w.hw[j] << std::endl;
}
break;
case Steim1Frame::Ffw:
......@@ -385,11 +387,112 @@ namespace datread {
os.width(2);
os.fill('0');
os << i << " fullword (" << f.ctrl(i) << "): "
<< f.w[i].fw << std::endl;
<< w.fw << std::endl;
break;
}
}
} // void dump(const EByteOrder& s, std::ostream& os)
} // void dump(const Steim1Frame& f, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const Steim2Frame& f, std::ostream& os)
{
os << "Steim 2 Frame:" << std::endl;
os << " control word: 0x";
std::ostream::fmtflags flags=os.flags();
os.setf(std::ios_base::hex, std::ios_base::basefield);
// os.setf(std::ios_base::showbase);
os.width(8);
os.fill('0');
os << f.control();
os.flags(flags);
os << std::endl;
/*
for (int i=0; i<Steim1Frame::nelements; ++i)
{
os << " ctrl #";
os.width(2);
os.fill('0');
os << i << ": " << f.ctrl(i) << std::endl;
}
*/
os << " data: " << std::endl;
for (int i=0; i<Steim2Frame::nwords; ++i)
{
Steim1Word w;
w.fw=f.word(i);
switch (f.ctrl(i)) {
case Steim2Frame::Fspecial:
os << " #";
os.width(2);
os.fill('0');
os << i << " special (" << f.ctrl(i) << "): "
<< w.fw << std::endl;
break;
case Steim2Frame::Fbyte:
for (int j=0; j<4; ++j)
{
os << " #";
os.width(2);
os.fill('0');
os << i << " byte (" << f.ctrl(i) << ") #" << j << ": "
<< int(w.byte[j]) << std::endl;
}
break;
case Steim1Frame::Fdnib1:
case Steim1Frame::Fdnib2:
Steim2Word word(f.ctrl(i), w.fw);
for (int j=0; j<word.nval(); ++j)
{
os << " #";
os.width(2);
os.fill('0');
os << i;
os.width(2);
os.fill(' ');
os << f.ctrl(i);
os.width(2);
os.fill(' ');
os << word.dnib();
os << " #" << j << ": "
<< word.value(j) << std::endl;
}
break;
}
}
} // void dump(const Steim2Frame& f, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const SteimFrame& f, std::ostream& os)
{
os << "Steim Frame:" << std::endl;
os << " control word: 0x";
std::ostream::fmtflags flags=os.flags();
os.setf(std::ios_base::hex, std::ios_base::basefield);
// os.setf(std::ios_base::showbase);
os.width(8);
os.fill('0');
os << f.control();
os.flags(flags);
os << std::endl;
/*
for (int i=0; i<Steim1Frame::nelements; ++i)
{
os << " ctrl #";
os.width(2);
os.fill('0');
os << i << ": " << f.ctrl(i) << std::endl;
}
*/
os << " data: " << std::endl;
f.reset();
while (f.valid())
{
os << " " << f.value() << std::endl;
f.next();
}
} // void dump(const SteimFrame& f, std::ostream& os)
} // namespace SEED
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructdump.h,v 1.5 2006-03-28 16:07:46 tforb Exp $
* $Id: seedstructdump.h,v 1.6 2006-05-09 17:04:03 tforb Exp $
* \author Thomas Forbriger
* \date 15/03/2006
*
......@@ -29,6 +29,7 @@
*
* REVISIONS and CHANGES
* - 15/03/2006 V1.0 Thomas Forbriger
* - 09/05/2006 V1.1 support generic Steim Frame
*
* ============================================================================
*/
......@@ -37,9 +38,9 @@
#ifndef TF_SEEDSTRUCTDUMP_H_VERSION
#define TF_SEEDSTRUCTDUMP_H_VERSION \
"TF_SEEDSTRUCTDUMP_H V1.0 "
"TF_SEEDSTRUCTDUMP_H V1.1"
#define TF_SEEDSTRUCTDUMP_H_CVSID \
"$Id: seedstructdump.h,v 1.5 2006-03-28 16:07:46 tforb Exp $"
"$Id: seedstructdump.h,v 1.6 2006-05-09 17:04:03 tforb Exp $"
#include<iostream>
#include<datreadxx/seedstructs.h>
......@@ -65,7 +66,9 @@ namespace datread {
void dump_ioflags(const unsigned char& s, std::ostream& os);
void dump(const EEncodingFormat& e, std::ostream& os);
void dump(const EByteOrder& e, std::ostream& os);
void dump(const SteimFrame& f, std::ostream& os);
void dump(const Steim1Frame& f, std::ostream& os);
void dump(const Steim2Frame& f, std::ostream& os);
} // namespace SEED
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructs.h,v 1.13 2006-05-09 16:36:38 tforb Exp $
* $Id: seedstructs.h,v 1.14 2006-05-09 17:04:03 tforb Exp $
* \author Thomas Forbriger
* \date 16/07/2004
*
......@@ -43,7 +43,7 @@
#define TF_SEEDSTRUCTS_H_VERSION \
"TF_SEEDSTRUCTS_H V1.2"
#define TF_SEEDSTRUCTS_H_CVSID \
"$Id: seedstructs.h,v 1.13 2006-05-09 16:36:38 tforb Exp $"
"$Id: seedstructs.h,v 1.14 2006-05-09 17:04:03 tforb Exp $"
namespace datread {
......@@ -467,6 +467,8 @@ namespace datread {
int word[nwords];
}; // struct FrameData
virtual ~SteimFrame() { }
//! return control word
int control() const { return(Mdata.control); }
//! return control code for word \c i
ESteimControl ctrl(const int& i) const;
//! return data word \c i
......
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