DATRW++ library: seismic data I/O with multiple formats
thiesdl1line.h
Go to the documentation of this file.
1 /*! \file thiesdl1line.h
2  * \brief handle a ThiesDL1 data line (prototypes)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 13/09/2011
8  *
9  * handle a ThiesDL1 data line (prototypes)
10  *
11  * Copyright (c) 2011 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  * - 13/09/2011 V1.0 Thomas Forbriger
31  *
32  * ============================================================================
33  */
34 
35 // include guard
36 #ifndef DATRW_THIESDL1LINE_H_VERSION
37 
38 #define DATRW_THIESDL1LINE_H_VERSION \
39  "DATRW_THIESDL1LINE_H V1.0 "
40 
41 #include <libtime++.h>
42 #include <datrwxx/error.h>
43 
44 namespace datrw {
45 
46  namespace thiesdl1 {
47 
48  //! \brief Exception indicating an inconsistent data line.
50  public Exception {
51  public:
52  //! Create with message, failed assertion, and code position
53  ExceptionInconsistentLine(const char* message,
54  const char* file,
55  const int& line,
56  const char* condition,
57  std::string dataline):
58  Exception(message, file, line, condition), Mdataline(dataline) { }
60  virtual void report() const;
61  private:
62  void my_report() const;
63  std::string Mdataline;
64  }; // class ExceptionInconsistentLine
65 
66  /*======================================================================*/
67 
68  /*! \brief Store one line of data as read from DL1.
69  */
70  class DataLine {
71  public:
72  //! swallow data line
73  DataLine(const std::string& line);
74  //! return data line
75  std::string line() const { return(Mline); }
76  //! return date and time
77  libtime::TAbsoluteTime time() const { return(Mtime); }
78  //! return value of precipitation
79  double precipitation() const { return(Mvalue); }
80  //! return count value
81  unsigned int counts() const { return(Mcounts); }
82 
83  //! gain value in mm/count
84  static const double gain;
85  private:
86  /*! check consistency of data line
87  * and fill data value fields
88  */
89  void evalline();
90 
91  //! literal data line as received from DL1
92  std::string Mline;
93  //! date and time of this sample
94  libtime::TAbsoluteTime Mtime;
95  //! value of sample in mm precipitation
96  double Mvalue;
97  //! value of sample in counts
98  unsigned int Mcounts;
99  }; // class DataLine
100 
101  } // namespace thiesdl1
102 
103 } // namespace datrw
104 
105 #endif // DATRW_THIESDL1LINE_H_VERSION (includeguard)
106 
107 /* ----- END OF thiesdl1line.h ----- */
unsigned int Mcounts
value of sample in counts
Definition: thiesdl1line.h:98
unsigned int counts() const
return count value
Definition: thiesdl1line.h:81
std::string Mline
literal data line as received from DL1
Definition: thiesdl1line.h:92
Store one line of data as read from DL1.
Definition: thiesdl1line.h:70
libtime::TAbsoluteTime time() const
return date and time
Definition: thiesdl1line.h:77
static const double gain
gain value in mm/count
Definition: thiesdl1line.h:84
std::string line() const
return data line
Definition: thiesdl1line.h:75
exception class declaration for libdatrwxx (prototypes)
double precipitation() const
return value of precipitation
Definition: thiesdl1line.h:79
Base class for exceptions.
Definition: exception.h:62
libtime::TAbsoluteTime Mtime
date and time of this sample
Definition: thiesdl1line.h:94
Root namespace of library.
Definition: aalibdatrwxx.cc:16
double Mvalue
value of sample in mm precipitation
Definition: thiesdl1line.h:96
ExceptionInconsistentLine(const char *message, const char *file, const int &line, const char *condition, std::string dataline)
Create with message, failed assertion, and code position.
Definition: thiesdl1line.h:53
Exception indicating an inconsistent data line.
Definition: thiesdl1line.h:49
DataLine(const std::string &line)
swallow data line
Definition: thiesdl1line.cc:71
virtual void report() const
Screen report.
Definition: thiesdl1line.cc:54