DATRW++ library: seismic data I/O with multiple formats
mseedread_mseedrecord_skipdata.cc
Go to the documentation of this file.
1 /*! \file mseedread_mseedrecord_skipdata.cc
2  * \brief member function mseed::MiniSEEDRecord::skipdata (implementation)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 23/06/2016
8  *
9  * member function mseed::MiniSEEDRecord::skipdata (implementation)
10  *
11  * Copyright (c) 2016 by Thomas Forbriger (BFO Schiltach)
12  *
13  *
14  * ----
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 
28  * ----
29  *
30  * REVISIONS and CHANGES
31  * - 23/06/2016 V1.0 Thomas Forbriger
32  *
33  * ============================================================================
34  */
35 #define DATRW_MSEEDREAD_MSEEDRECORD_SKIPDATA_CC_VERSION \
36  "DATRW_MSEEDREAD_MSEEDRECORD_SKIPDATA_CC V1.0"
37 
38 #include <datrwxx/mseedread.h>
39 
40 namespace datrw {
41 
42  namespace mseed {
43 
44  /*----------------------------------------------------------------------*/
45  // small effort of skipping a MiniSEED record
46 
47  /*!
48  * \note
49  * Apparently this function is not used at all.
50  * It probably is useless, because datrw::mseed::imseedstream::read
51  * requires to extract block data in order to control whether data is
52  * contiguous.
53  * With some data the amount of actual samples and the amount of data
54  * blocks required to store them is only well established after decoding
55  * all data frames.
56  *
57  * \deprecated
58  * This function appears obsolete and might be removed in the future.
59  */
60  void MiniSEEDRecord::skipdata(std::istream& is)
61  {
62  // create block to read MiniSEED
63  MiniSEEDblock block=this->readheader(is);
64  // count blocks
65  int iblock=0;
66 
67  if (Mvalid)
68  {
69  // data header is present
70  ++iblock;
71 
72  // size of record in bytes
73  int reclen=Mblockette1000.reclenbytes();
74  // number of blocks to read for full record
75  int nblocks=reclen/block.bytesize();
76  Mdata=Tseries(0,1);
77 
78  // extract samples
79  // ---------------
80  while (iblock < nblocks)
81  {
82  is >> block;
83  if (is.bad())
84  {
85  std::cerr << "WARNING (reading MiniSEED record): "
86  << "input stream is bad!" << std::endl;
87  }
88  ++iblock;
89  }
90 
91  // finished successfully
92  if (is.good()) { Mvalid=true; }
93  }
94  } // void MiniSEEDRecord::skipdata(std::istream& is)
95 
96  } // namespace mseed
97 
98 } // namespace datrw
99 
100 /* ----- END OF mseedread_mseedrecord_skipdata.cc ----- */
MiniSEEDblock readheader(std::istream &is)
read header and return block
unsigned int bytesize() const
Definition: mseedread.h:90
aff::Series< Tvalue > Tseries
type of container for sample data
Definition: mseedread.h:159
Root namespace of library.
Definition: aalibdatrwxx.cc:16
Tseries Mdata
Container for sample data.
Definition: mseedread.h:245
void skipdata(std::istream &is)
only read header and blockettes, no data
SEED::DataOnlySEEDBlockette Mblockette1000
Data Only SEED Blockette.
Definition: mseedread.h:239
bool Mvalid
contains valid data
Definition: mseedread.h:227