DATRW++ library: seismic data I/O with multiple formats
tsoftreader.h
Go to the documentation of this file.
1 /*! \file tsoftreader.h
2  * \brief module to read TSOFT data (prototypes)
3  * \ingroup group_tsoft
4  *
5  * ----------------------------------------------------------------------------
6  *
7  * \author Thomas Forbriger
8  * \date 16/09/2009
9  *
10  * module to read TSOFT data (prototypes)
11  *
12  * Copyright (c) 2009 by Thomas Forbriger (BFO Schiltach)
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, write to the Free Software
27  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28  * ----
29  *
30  * REVISIONS and CHANGES
31  * - 16/09/2009 V1.0 Thomas Forbriger
32  *
33  * ============================================================================
34  */
35 
36 // include guard
37 #ifndef DATRW_TSOFTREADER_H_VERSION
38 
39 #define DATRW_TSOFTREADER_H_VERSION \
40  "DATRW_TSOFTREADER_H V1.0 "
41 
42 #include<datrwxx/tsoftdata.h>
43 #include<datrwxx/tsoftconfig.h>
44 
45 namespace datrw {
46 
47  namespace tsoft {
48 
49  /*! \brief string constant to check TSOFT file id
50  * \ingroup group_tsoftconst
51  */
52  extern const char* TSOFTID;
53 
54  /*----------------------------------------------------------------------*/
55 
56  /*! \brief check list for requiered fields
57  * \ingroup group_tsoft
58  */
59  struct Checklist {
60  public:
61  //! default constructor
62  Checklist();
63  //! check whether all are checked
64  bool allchecked() const;
65  //! report check status
66  void report(std::ostream& os) const;
67  public:
68  bool fileid;
69  bool timeformat;
70  bool increment;
71  bool channels;
72  bool units;
73  bool undetval;
74  bool data;
75  private:
76  static void reportitem(std::ostream& os,
77  const char* tag,
78  const bool& flag);
79  }; // struct Checklist
80 
81  /*----------------------------------------------------------------------*/
82 
83  /*! \brief read a complete file
84  * \ingroup group_tsoft
85  */
86  class TSOFTfile {
87  public:
88  //! create by reading
89  TSOFTfile(std::istream& is,
90  const bool& debug=false)
91  {
92  this->read(is, debug);
93  }
94  //! create by reading
95  TSOFTfile(std::istream& is,
96  const ReaderConfig& rc,
97  const bool& debug=false):
99  {
100  this->read(is, debug);
101  }
102  //! read from stream
103  void read(std::istream& is,
104  const bool& debug=false);
105  //! return number of channels
106  int nchannels() const { return Mdatacontainer.nchannels(); }
107  //! return number of channels
108  const Datacontainer& dc() const { return Mdatacontainer; }
109  //! return number of channels
111  //! return free lines
112  const Tlos& free() const { return Mfree; }
113  private:
114  //! store header
116  //! store channel info
118  //! sampling interval
119  libtime::TRelativeTime Mincrement;
120  //! store undetval
121  double Mundetval;
122  //! my checklist
124  //! Reader configuration
126  }; // class TSOFTfile
127 
128  } // namespace tsoft
129 
130 } // namespace datrw
131 
132 #endif // DATRW_TSOFTREADER_H_VERSION (includeguard)
133 
134 /* ----- END OF tsoftreader.h ----- */
config parameters for data extractionThese parameters control the way gaps in the input data are hand...
Definition: tsoftconfig.h:57
bool allchecked() const
check whether all are checked
Definition: tsoftreader.cc:87
std::list< std::string > Tlos
list of strings.
Definition: tsoftdata.h:108
libtime::TRelativeTime Mincrement
sampling interval
Definition: tsoftreader.h:119
Checklist Mchecklist
my checklist
Definition: tsoftreader.h:123
Datacontainer Mdatacontainer
store channel info
Definition: tsoftreader.h:117
double Mundetval
store undetval
Definition: tsoftreader.h:121
data container.
Definition: tsoftdata.h:385
int nchannels() const
return number of channels
Definition: tsoftdata.h:421
static void reportitem(std::ostream &os, const char *tag, const bool &flag)
Definition: tsoftreader.cc:76
TSOFTfile(std::istream &is, const ReaderConfig &rc, const bool &debug=false)
create by reading
Definition: tsoftreader.h:95
void read(std::istream &is, const bool &debug=false)
read from stream
Definition: tsoftreader.cc:96
Tlos Mfree
store header
Definition: tsoftreader.h:115
ReaderConfig Mreaderconfig
Reader configuration.
Definition: tsoftreader.h:125
read a complete file
Definition: tsoftreader.h:86
Root namespace of library.
Definition: aalibdatrwxx.cc:16
void report(std::ostream &os) const
report check status
Definition: tsoftreader.cc:63
int nchannels() const
return number of channels
Definition: tsoftreader.h:106
TSOFTfile(std::istream &is, const bool &debug=false)
create by reading
Definition: tsoftreader.h:89
check list for requiered fields
Definition: tsoftreader.h:59
const Tlos & free() const
return free lines
Definition: tsoftreader.h:112
Checklist()
default constructor
Definition: tsoftreader.cc:56
Datacontainer & dc()
return number of channels
Definition: tsoftreader.h:110
const Datacontainer & dc() const
return number of channels
Definition: tsoftreader.h:108
const char * TSOFTID
string constant to check TSOFT file id
Definition: tsoftreader.cc:51