readtsdata.h 7.13 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
/*! \file readtsdata.h
thomas.forbriger's avatar
GPL    
thomas.forbriger committed
2
3
 * \brief read waveform data through the interface provided by libdatreadxx 
 * (prototypes)
thomas.forbriger's avatar
thomas.forbriger committed
4
5
6
 * 
 * ----------------------------------------------------------------------------
 * 
thomas.forbriger's avatar
thomas.forbriger committed
7
 * $Id: readtsdata.h,v 1.5 2007-02-12 10:58:50 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
8
9
10
 * \author Thomas Forbriger
 * \date 31/01/2007
 * 
thomas.forbriger's avatar
GPL    
thomas.forbriger committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * read waveform data through the interface provided by libdatreadxx 
 * (prototypes)
 *
 * ----
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ----
thomas.forbriger's avatar
thomas.forbriger committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 * 
 * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) 
 * 
 * REVISIONS and CHANGES 
 *  - 31/01/2007   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */

// include guard
#ifndef TF_READTSDATA_H_VERSION

#define TF_READTSDATA_H_VERSION \
  "TF_READTSDATA_H   V1.0   "
#define TF_READTSDATA_H_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
44
  "$Id: readtsdata.h,v 1.5 2007-02-12 10:58:50 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
45
46
47
48
49
50
51
52

#include<tfxx/rangelist.h>
#include<tfxx/xcmdline.h>
#include<tfxx/rangestring.h>
#include<datreadxx/readany.h>
#include<tsxx/sffheaders.h>
#include<iostream>
#include<fstream>
thomas.forbriger's avatar
thomas.forbriger committed
53

thomas.forbriger's avatar
thomas.forbriger committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*! \defgroup group_readtsdata Reading of time series data.
 * \brief Read a complete set of time series including the selection of
 *   traces.
 *
 * The module is presented in namespace tfxx::tsio.
 *
 */

/*! \brief Interface provided through readtsdata.h
 *
 * \defgroup readtsdata_h Interface provided through readtsdata.h
 * 
 * \ingroup group_readtsdata
 */
namespace tfxx {

/*! \namespace tfxx::tsio
 * \brief Namespace containing all components of module readtsdata.
 * \ingroup group_readtsdata, readtsdata_h
 */
  namespace tsio {

thomas.forbriger's avatar
thomas.forbriger committed
76
77
78
79
80
81
82
83
84
85
86
87
    /*! \brief type of trace selection list.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * This is the rangelist class that holds a selection of traces in
     * numerical form. It can be generated generated from an approriate string
     * on the command line through:
     * \code
     * Ttracelist selection=
     *   tfxx::string::rangelist<Ttracelist::Tvalue>(filename.value(tracekey));
     * \endcode
     */
thomas.forbriger's avatar
thomas.forbriger committed
88
89
    typedef tfxx::RangeList<int> Ttracelist;

thomas.forbriger's avatar
thomas.forbriger committed
90
91
92
93
94
95
96
    /*! \brief type of trace selection key.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * This typedef is given here to make the argument definitions more
     * verbose.
     */
thomas.forbriger's avatar
thomas.forbriger committed
97
    typedef const char* Ttracelistkey;
thomas.forbriger's avatar
thomas.forbriger committed
98

thomas.forbriger's avatar
thomas.forbriger committed
99
100
101
102
103
104
105
106
107
108
109
110
    /*! \brief structure to contain file data together with command line
     * arguments.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * A struct to hold a complete data file including
     * -# command line arguments associated with the file
     * -# the file header
     * -# headers and samples from all selected traces
     *
     * This specific struct will hold samples in form of doubles.
     */
thomas.forbriger's avatar
thomas.forbriger committed
111
    struct DFile {
thomas.forbriger's avatar
thomas.forbriger committed
112
      //! provides reading into doubles
thomas.forbriger's avatar
thomas.forbriger committed
113
      typedef double Tvalue;
thomas.forbriger's avatar
thomas.forbriger committed
114
      //! container to be used
thomas.forbriger's avatar
thomas.forbriger committed
115
      typedef aff::Series<Tvalue> Tseries;
thomas.forbriger's avatar
thomas.forbriger committed
116
      //! file container
thomas.forbriger's avatar
thomas.forbriger committed
117
      typedef ts::sff::File<Tseries> Tfile;
thomas.forbriger's avatar
thomas.forbriger committed
118
      //! command line arguments
thomas.forbriger's avatar
thomas.forbriger committed
119
      tfxx::cmdline::Filename arguments;
thomas.forbriger's avatar
thomas.forbriger committed
120
      //! container to hold data headers and samples
thomas.forbriger's avatar
thomas.forbriger committed
121
      ts::sff::File<Tseries> data;
thomas.forbriger's avatar
thomas.forbriger committed
122
    }; // struct File
thomas.forbriger's avatar
thomas.forbriger committed
123

thomas.forbriger's avatar
thomas.forbriger committed
124
125
126
127
128
129
130
    /*! \brief complete list of files.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * A list of DFile structs, to store all data files provided on the
     * command line at once.
     */
thomas.forbriger's avatar
thomas.forbriger committed
131
    typedef std::list<DFile> TDFileList;
thomas.forbriger's avatar
thomas.forbriger committed
132
    
thomas.forbriger's avatar
thomas.forbriger committed
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
    /*! \brief read complete SFF file.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * Read a complete data file with headers and samples at once.
     *
     * \return structure that contains file data together with command line
     *    arguments
     * \param filename input file name of file to be read
     * \param verbose select verbosity
     * \param format data format to be read
     */
    DFile readDSFF(const std::string& filename,
                   const bool& verbose=false,
                   const datread::Eformat& format=datread::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
148

thomas.forbriger's avatar
thomas.forbriger committed
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    /*! \brief read complete SFF file with trace selection.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * Read a complete data file with all headers and samples but only for the
     * selected traces.
     *
     * \return structure that contains file data together with command line
     *    arguments (here: only file name)
     * \param filename input file name of file to be read
     * \param selection numerical list of selected traces
     * \param verbose select verbosity
     * \param format data format to be read
     */
thomas.forbriger's avatar
thomas.forbriger committed
163
    DFile readDSFF(const std::string& filename,
thomas.forbriger's avatar
thomas.forbriger committed
164
                   const Ttracelist& selection,
thomas.forbriger's avatar
thomas.forbriger committed
165
166
                   const bool& verbose=false,
                   const datread::Eformat& format=datread::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
167

thomas.forbriger's avatar
thomas.forbriger committed
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
    /*! \brief read complete SFF file with trace selection.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * Read a complete data file, but take selection from the structure of
     * command line arguments.
     *
     * \return structure that contains file data together with command line
     *    arguments (here: only file name)
     * \param filename input file name together with command line options and
     *    arguments
     * \param verbose select verbosity
     * \param tracekey key string for command line option that defines trace
     *   selection
     * \param format data format to be read
     */
thomas.forbriger's avatar
thomas.forbriger committed
184
185
    DFile readDSFF(const tfxx::cmdline::Filename& filename,
                   const bool& verbose=false,
thomas.forbriger's avatar
thomas.forbriger committed
186
                   Ttracelistkey tracekey="t",
thomas.forbriger's avatar
thomas.forbriger committed
187
                   const datread::Eformat& format=datread::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
188

thomas.forbriger's avatar
thomas.forbriger committed
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    /*! \brief read complete list of SFF files with trace selection.
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * Read a complete set of files like defined in the structure of command
     * line arguments.
     *
     * \return structure that contains file data together with command line
     *    arguments
     * \param flist list of file names together with
     *   command line options and arguments
     * \param verbose select verbosity
     * \param tracekey key string for command line option that defines trace
     *   selection
     * \param format data format to be read
     */
thomas.forbriger's avatar
thomas.forbriger committed
205
206
    TDFileList readDSFF(const tfxx::cmdline::Tparsed& flist,
                        const bool& verbose=false,
thomas.forbriger's avatar
thomas.forbriger committed
207
                        Ttracelistkey tracekey="t",
thomas.forbriger's avatar
thomas.forbriger committed
208
                        const datread::Eformat& format=datread::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
209
210
211


  } // namespace tsio
thomas.forbriger's avatar
thomas.forbriger committed
212

thomas.forbriger's avatar
thomas.forbriger committed
213
} // namespace tfxx
thomas.forbriger's avatar
thomas.forbriger committed
214
215
216
217

#endif // TF_READTSDATA_H_VERSION (includeguard)

/* ----- END OF readtsdata.h ----- */