DATRW++ library: seismic data I/O with multiple formats
su.h
Go to the documentation of this file.
1 /*! \file su.h
2  * \brief read Seismic Unix data (prototypes)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 19/11/2010
8  *
9  * read Seismic Unix data (prototypes)
10  *
11  * Copyright (c) 2010 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  * REVISIONS and CHANGES
30  * - 19/11/2010 V1.0 Thomas Forbriger
31  * - 23/11/2010 V1.1 introduced static member data
32  * - 07/06/2011 V1.2 promise constness of series samples
33  * - 21/01/2012 V1.3
34  * - prepared isustream and osustream to take modifiers
35  * - use SUHeaderControl to store format modifier values
36  * - 24/01/2012 V1.4 there is a subtle bute relevant difference in the
37  * possible orders of member data fields of isustream:
38  * Mheadercontrol must be first, followed by
39  * Mnextheader. Otherwise Mnexheader is
40  * initialized with a non-initialized Mheadercontrol
41  * which contains the improper scalco value "0"; the
42  * wrong order results in warning messages each time
43  * the code is used and in an unavoidable abort if the
44  * strict format modifier is set
45  * - 18/11/2016 V1.5 use debug flag in base class
46  *
47  * ============================================================================
48  */
49 
50 // include guard
51 #ifndef DATRW_SU_H_VERSION
52 
53 #define DATRW_SU_H_VERSION \
54  "DATRW_SU_H V1.5"
55 
56 #include <datrwxx/datread.h>
57 #include <datrwxx/datwrite.h>
58 #include <datrwxx/suheader.h>
59 #include <datrwxx/suformat.h>
60 
61 namespace datrw {
62 
63  namespace su {
64 
65  extern const bool isbinary;
66  extern const char* const streamID;
67 
68  } // namespace su
69 
70  /*----------------------------------------------------------------------*/
71 
72  /*! \brief class to read SeismicUnix data
73  *
74  * \ingroup group_su
75  */
76  class isustream: public idatstream {
77  public:
78  typedef idatstream Tbase;
79  isustream(std::istream& is,
80  const std::string& modifier="",
81  const bool& debug=false);
82  virtual ~isustream() { }
83  virtual Tdseries dseries();
84  virtual Tfseries fseries();
85  virtual void skipseries();
86  static void help(std::ostream& os=std::cout);
87  static const std::ios_base::openmode openmode;
88  private:
89  void readheader();
92  }; // class isustream
93 
94  /*----------------------------------------------------------------------*/
95 
96  /*! \brief class to write SU data
97  *
98  * \ingroup group_su
99  */
100  class osustream: public odatstream {
101  public:
102  typedef odatstream Tbase;
103  osustream(std::ostream& os,
104  const std::string& modifier="",
105  const bool& debug=false);
106  inline virtual ~osustream() { }
107  static void help(std::ostream& os=std::cout);
108  static const std::ios_base::openmode openmode;
109  protected:
110  virtual void writefileheader();
111  virtual void writetrace(const Tdseries::Tcoc& series);
112  virtual void writetrace(const Tfseries::Tcoc& series);
113  virtual void writetrace(const Tiseries::Tcoc& series);
114  private:
115  unsigned int Mitrace;
117  }; // class osustream
118 
119 } // namespace datrw
120 
121 #endif // DATRW_SU_H_VERSION (includeguard)
122 
123 /* ----- END OF su.h ----- */
virtual Tfseries fseries()
Definition: isustream.cc:87
unsigned int Mitrace
Definition: su.h:115
aff::Series< float > Tfseries
Definition: types.h:46
virtual Tdseries dseries()
Definition: isustream.cc:80
datrw::su::options::SUHeaderControl Mheadercontrol
Definition: su.h:90
C++ class to handle Seismic Un*x header struct.
Definition: suheader.h:123
static const std::ios_base::openmode openmode
Definition: su.h:108
aff::Series< double > Tdseries
Definition: types.h:45
isustream(std::istream &is, const std::string &modifier="", const bool &debug=false)
Definition: isustream.cc:59
virtual ~isustream()
Definition: su.h:82
datrw::su::SUheader Mnextheader
Definition: su.h:91
idatstream Tbase
Definition: su.h:78
bool debug()
indicate debug mode
Definition: datwrite.h:145
virtual void writetrace(const Tdseries::Tcoc &series)
write double data by passing samples to float function
Definition: osustream.cc:128
virtual ~osustream()
Definition: su.h:106
bool debug()
indicate debug mode
Definition: datread.h:116
static void help(std::ostream &os=std::cout)
Definition: isustream.cc:154
Root namespace of library.
Definition: aalibdatrwxx.cc:16
odatstream Tbase
Definition: su.h:102
static const std::ios_base::openmode openmode
Definition: su.h:87
const bool isbinary
Format properties.
Definition: suformat.cc:51
static void help(std::ostream &os=std::cout)
Definition: osustream.cc:72
const char *const streamID
Format properties.
Definition: suformat.cc:52
virtual void writefileheader()
Should write file header, but SU does not have one.
Definition: osustream.cc:119
osustream(std::ostream &os, const std::string &modifier="", const bool &debug=false)
Definition: osustream.cc:58
datrw::su::options::SUHeaderControl Mheadercontrol
Definition: su.h:116
virtual void skipseries()
Definition: isustream.cc:108
class to read SeismicUnix data
Definition: su.h:76
class to write SU data
Definition: su.h:100
options to control the way header variables are handeled.
Definition: suformat.h:168
generic interface definition (prototypes)