DATRW++ library: seismic data I/O with multiple formats
igsestream.cc
Go to the documentation of this file.
1 /*! \file igsestream.cc
2  * \brief read raw GSE data (implementation)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 19/09/2007
8  *
9  * read raw GSE data (implementation)
10  *
11  * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
12  *
13  * ----
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27  * ----
28  *
29  *
30  * REVISIONS and CHANGES
31  * - 19/09/2007 V1.0 Thomas Forbriger
32  * - 23/11/2010 V1.1 introduced static members
33  *
34  * ============================================================================
35  */
36 #define DATRW_IGSESTREAM_CC_VERSION \
37  "DATRW_IGSESTREAM_CC V1.1"
38 
39 #include <string>
40 #include <sstream>
41 #include <datrwxx/gse.h>
42 #include <datrwxx/gseread.h>
43 #include <datrwxx/error.h>
44 #include <datrwxx/util.h>
45 
46 namespace datrw {
47 
48  const std::ios_base::openmode igsestream::openmode=std::ios_base::in;
49 
50  //@{
51  /*! \brief Format properties
52  * \ingroup group_gse
53  */
54  const bool gse::isbinary=false;
55  const char* const gse::streamID="gse";
56  //@}
57 
58  /*----------------------------------------------------------------------*/
59 
60  igsestream::igsestream(std::istream& is): Tbase(is, true, true, true)
61  { }
62 
63  /*----------------------------------------------------------------------*/
64 
66  {
67  return(datrw::util::convert<Tiseries, Tdseries>(this->iseries()));
68  }
69 
70  /*----------------------------------------------------------------------*/
71 
73  {
74  this->readheader();
75  DATRW_assert(Mis.good(), "input stream is not good");
76  return(datrw::gse::read_gse_data(this->Mis, this->wid2().nsamples));
77  }
78 
79  /*----------------------------------------------------------------------*/
80 
82  {
83  return(datrw::util::convert<Tiseries, Tfseries>(this->iseries()));
84  }
85 
86  /*----------------------------------------------------------------------*/
87 
89  {
90  this->readheader();
91  }
92 
93  /*----------------------------------------------------------------------*/
94 
96  {
97  this->newtrace();
98  this->setwid2(datrw::gse::next_wid2(this->Mis));
99  this->setlast();
100  }
101 
102  /*----------------------------------------------------------------------*/
103 
104  void igsestream::help(std::ostream& os)
105  { datrw::gse::help(os); }
106 
107 } // namespace datrw
108 
109 /* ----- END OF igsestream.cc ----- */
static const std::ios_base::openmode openmode
Definition: gse.h:69
virtual Tdseries dseries()
Definition: igsestream.cc:65
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
sff::WID2 next_wid2(std::istream &is)
find next WID2 line
Definition: gseread.cc:49
aff::Series< float > Tfseries
Definition: types.h:46
virtual Tfseries fseries()
Definition: igsestream.cc:81
const bool isbinary
Format properties.
Definition: igsestream.cc:54
sff::WID2 wid2() const
Definition: datread.h:111
const char *const streamID
Format properties.
Definition: igsestream.cc:55
aff::Series< double > Tdseries
Definition: types.h:45
const int nsamples
number of samples per minute block and channel
Definition: hpmodata.h:51
exception class declaration for libdatrwxx (prototypes)
Tiseries read_gse_data(std::istream &is, const int &nsamples)
read samples from file
Definition: gseread.cc:92
std::istream & Mis
Definition: datread.h:126
void setwid2(const sff::WID2 &wid2)
Definition: datread.cc:113
Root namespace of library.
Definition: aalibdatrwxx.cc:16
igsestream(std::istream &is)
Definition: igsestream.cc:60
utilities used by more than one type of data reader (prototypes)
read raw GSE data (prototypes)
static void help(std::ostream &os=std::cout)
Definition: igsestream.cc:104
aff::Series< int > Tiseries
Definition: types.h:47
void help(std::ostream &os)
print info about GSE reading
Definition: gseread.cc:75
virtual void skipseries()
Definition: igsestream.cc:88
virtual Tiseries iseries()
Definition: igsestream.cc:72