DATRW++ library: seismic data I/O with multiple formats
formats.h
Go to the documentation of this file.
1 /*! \file formats.h
2  * \brief common description of formats (prototypes)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 26/11/2010
8  *
9  * common description of formats (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  * - 26/11/2010 V1.0 Thomas Forbriger
31  * - 02/09/2011 V1.1 support seife format
32  * - 03/11/2011 V1.2 added data formats ASCII, binary, and ThiesDL1
33  * - 05/12/2011 V1.3 provide format specfic online help
34  *
35  * ============================================================================
36  */
37 
38 // include guard
39 #ifndef DATRW_FORMATS_H_VERSION
40 
41 #define DATRW_FORMATS_H_VERSION \
42  "DATRW_FORMATS_H V1.3"
43 
44 #include <iostream>
45 #include <string>
46 
47 namespace datrw {
48 
49  /*! ID flags for supported file formats
50  *
51  * These flags are used for input as well as for output streams.
52  * Not all of them will be supported by input and output streams as well.
53  */
54  enum Eformat {
55  Fsff, //<! SFF data
56  Fpdas, //<! PDAS data
57  Fhpmo, //<! BFO HP-MO data (Grossmann format)
58  Fmseed, //<! MiniSEED data
59  Fbonjer, //<! Format specified by K. Bonjer
60  Fsac, //<! SAC binary data
61  Fgse, //<! raw GSE data
62  Ftsoft, //<! TSOFT data
63  Ftfascii, //<! ASCII format of T. Forbrigers any2ascii
64  Fsu, //<! SeismicUn*x format
65  Fseife, //<! seife format
66  Fascii, //<! raw ASCII format
67  Fbinary, //<! raw binary format
68  Fthiesdl1 //<! Thies DL1 pluviometer data format
69  }; // enum Eformat
70 
71  /*----------------------------------------------------------------------*/
72 
73  /*! ID flags to indicate variable type used for storing samples
74  *
75  * \todo
76  * move this to datatypes.h
77  *
78  * \deprecated
79  * The use of Edatatype flags is deprecated and will be replaced by
80  * a more verbose class or struct which can be extended in the future
81  *
82  * \sa \ref page_properties
83  */
84  enum Edatatype {
85  Fint, //<! File format uses integer data
86  Ffloat, //<! File format uses float data
87  Fdouble, //<! File format uses double data
88  Fall //<! File format is able to store any data type
89  }; // enum Edatatype
90 
91  /*----------------------------------------------------------------------*/
92 
93  //! true, if underlying file format is binary
94  bool isbinary(const Eformat& format);
95 
96  /*! \brief convert identifier from and to string representation
97  * @{
98  */
99  Eformat anyID(std::string identifier);
100  std::string anyID(const Eformat& id);
101  /**@}*/
102 
103  // print out information about supported data types
104  void supported_data_types(std::ostream& os=std::cout);
105 
106  // print out information about supported data types for input
107  void supported_input_data_types(std::ostream& os=std::cout);
108 
109  // print out information about supported data types for output
110  void supported_output_data_types(std::ostream& os=std::cout);
111 
112  // print out information about data conversion
113  void online_help(std::ostream& os=std::cout);
114 
115  // print out information about data conversion for on specific format
116  void online_help(const Eformat& format,
117  std::ostream& os=std::cout,
118  const bool& modifierhelp=false);
119 
120  // print out information about data conversion for on specific format
121  void online_help(const std::string& format,
122  std::ostream& os=std::cout,
123  const bool& modifierhelp=false);
124 
125 } // namespace datrw
126 
127 #endif // DATRW_FORMATS_H_VERSION (includeguard)
128 
129 /* ----- END OF formats.h ----- */
Edatatype
Definition: formats.h:84
Eformat anyID(std::string formatstring)
convert identifier from and to string representation
Definition: formats.cc:68
void supported_output_data_types(std::ostream &os)
Definition: formats.cc:276
void online_help(const std::string &format, std::ostream &os, const bool &modifierhelp)
Definition: formats.cc:120
bool isbinary(const Eformat &format)
true, if underlying file format is binary
Definition: readany.cc:84
Root namespace of library.
Definition: aalibdatrwxx.cc:16
void supported_data_types(std::ostream &os)
Definition: formats.cc:290
void supported_input_data_types(std::ostream &os)
Definition: formats.cc:249
Eformat
Definition: formats.h:54