cmdlinefiles.h 18.6 KB
Newer Older
1
2
3
/*! \file cmdlinefiles.h
 * \brief containers for data files with file specific command line parameters
 *        (prototypes).
thomas.forbriger's avatar
thomas.forbriger committed
4
5
6
 * 
 * ----------------------------------------------------------------------------
 * 
7
 * $Id: $
thomas.forbriger's avatar
thomas.forbriger committed
8
 * \author Thomas Forbriger
9
10
11
12
 * \since 31/01/2007
 * \date 30/01/2014
 * 
 * Copyright (c) 2007, 2010, 2011, 2014 by Thomas Forbriger (BFO Schiltach) 
thomas.forbriger's avatar
thomas.forbriger committed
13
 * 
14
 * containers for data files with file specific command line parameters
thomas.forbriger's avatar
GPL    
thomas.forbriger committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * (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
 * ----
32
 *
thomas.forbriger's avatar
thomas.forbriger committed
33
 * REVISIONS and CHANGES 
34
35
 *  - 30/01/2014   V1.0   Thomas Forbriger (thof):
 *                        copied from readtsdata.h
thomas.forbriger's avatar
thomas.forbriger committed
36
37
38
39
40
 * 
 * ============================================================================
 */

// include guard
41
#ifndef TSIO_CMDLINEFILES_H_VERSION
thomas.forbriger's avatar
thomas.forbriger committed
42

43
44
45
46
#define TSIO_CMDLINEFILES_H_VERSION \
  "TF_CMDLINEFILES_H   2014/01/30"
#define TSIO_CMDLINEFILES_H_CVSID \
  "$Id: $"
thomas.forbriger's avatar
thomas.forbriger committed
47

48
#include<tsioxx/sfftsfile.h>
thomas.forbriger's avatar
thomas.forbriger committed
49
#include<tfxx/xcmdline.h>
50
#include<datrwxx/readany.h>
thomas.forbriger's avatar
thomas.forbriger committed
51

thomas.forbriger's avatar
thomas.forbriger committed
52
53
54
55
56
57
/*! \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.
 *
58
59
60
61
62
63
 * This module is presented in file readtsdata.h
 *
 * It is placed ton top of the module presented in sffheaders.h
 * and supports to read a complete set of files as presented on the command
 * line together with all file specific parameters and trace selectors.
 *
thomas.forbriger's avatar
thomas.forbriger committed
64
65
 */

66
67
68
namespace ts {

  namespace sff {
thomas.forbriger's avatar
thomas.forbriger committed
69

thomas.forbriger's avatar
thomas.forbriger committed
70
71
72
73
74
75
76
77
78
79
80
81
    /*! \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
82
83
    typedef tfxx::RangeList<int> Ttracelist;

thomas.forbriger's avatar
thomas.forbriger committed
84
85
86
87
88
89
90
    /*! \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
91
    typedef const char* Ttracelistkey;
thomas.forbriger's avatar
thomas.forbriger committed
92

thomas.forbriger's avatar
thomas.forbriger committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

    /*! \brief structure to contain file data together with command line
     * arguments (single precision).
     *
     * \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.
     */
    struct SFile {
      //! provides reading into doubles
      typedef float Tvalue;
      //! container to be used
      typedef aff::Series<Tvalue> Tseries;
      //! file container
      typedef ts::sff::File<Tseries> Tfile;
      //! command line arguments
      tfxx::cmdline::Filename arguments;
      //! container to hold data headers and samples
      ts::sff::File<Tseries> data;
    }; // struct SFile

thomas.forbriger's avatar
thomas.forbriger committed
119
120
121
122
123
124
125
126
127
128
129
130
    /*! \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
131
    struct DFile {
thomas.forbriger's avatar
thomas.forbriger committed
132
      //! provides reading into doubles
thomas.forbriger's avatar
thomas.forbriger committed
133
      typedef double Tvalue;
thomas.forbriger's avatar
thomas.forbriger committed
134
      //! container to be used
thomas.forbriger's avatar
thomas.forbriger committed
135
      typedef aff::Series<Tvalue> Tseries;
thomas.forbriger's avatar
thomas.forbriger committed
136
      //! file container
thomas.forbriger's avatar
thomas.forbriger committed
137
      typedef ts::sff::File<Tseries> Tfile;
thomas.forbriger's avatar
thomas.forbriger committed
138
      //! command line arguments
thomas.forbriger's avatar
thomas.forbriger committed
139
      tfxx::cmdline::Filename arguments;
thomas.forbriger's avatar
thomas.forbriger committed
140
      //! container to hold data headers and samples
thomas.forbriger's avatar
thomas.forbriger committed
141
      ts::sff::File<Tseries> data;
thomas.forbriger's avatar
thomas.forbriger committed
142
    }; // struct DFile
thomas.forbriger's avatar
thomas.forbriger committed
143

thomas.forbriger's avatar
thomas.forbriger committed
144
145
146
147
148
149
150
    /*! \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
151
    typedef std::list<DFile> TDFileList;
thomas.forbriger's avatar
thomas.forbriger committed
152
153
154
155
156
157
158
159
160

    /*! \brief complete list of files (single precision version).
     *
     * \ingroup group_readtsdata, readtsdata_h
     *
     * A list of DFile structs, to store all data files provided on the
     * command line at once.
     */
    typedef std::list<SFile> TSFileList;
thomas.forbriger's avatar
thomas.forbriger committed
161
    
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
    /*======================================================================*/

    /*! \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 std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \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
     */
    DFile readDSFF(const std::string& filename,
                   const Ttracelist& selection,
                   const bool& verbose=false,
                   const std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \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
     */
    DFile readDSFF(const tfxx::cmdline::Filename& filename,
                   const bool& verbose=false,
                   Ttracelistkey tracekey="t",
                   const std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \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
     */
    TDFileList readDSFF(const tfxx::cmdline::Tparsed& flist,
                        const bool& verbose=false,
                        Ttracelistkey tracekey="t",
                        const std::string& format=datrw::anyID(datrw::Fsff));
    
    /*----------------------------------------------------------------------*/

    /*! \brief read complete SFF file (single precision version).
     *
     * \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
     */
    SFile readSSFF(const std::string& filename,
                   const bool& verbose=false,
                   const std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \brief read complete SFF file with trace selection (single precision
     * version).
     *
     * \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
     */
    SFile readSSFF(const std::string& filename,
                   const Ttracelist& selection,
                   const bool& verbose=false,
                   const std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \brief read complete SFF file with trace selection (single precision
     * version).
     *
     * \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
     */
    SFile readSSFF(const tfxx::cmdline::Filename& filename,
                   const bool& verbose=false,
                   Ttracelistkey tracekey="t",
                   const std::string& format=datrw::anyID(datrw::Fsff));

    /*----------------------------------------------------------------------*/

    /*! \brief read complete list of SFF files with trace selection (single
     * precision version).
     *
     * \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
     */
    TSFileList readSSFF(const tfxx::cmdline::Tparsed& flist,
                        const bool& verbose=false,
                        Ttracelistkey tracekey="t",
                        const std::string& format=datrw::anyID(datrw::Fsff));

    /*======================================================================*/

thomas.forbriger's avatar
thomas.forbriger committed
337
338
339
340
341
342
343
344
345
346
347
348
349
350
    /*! \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,
351
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
352

353
354
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    /*! \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
369
    DFile readDSFF(const std::string& filename,
thomas.forbriger's avatar
thomas.forbriger committed
370
                   const Ttracelist& selection,
thomas.forbriger's avatar
thomas.forbriger committed
371
                   const bool& verbose=false,
372
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
373

374
375
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
    /*! \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
392
393
    DFile readDSFF(const tfxx::cmdline::Filename& filename,
                   const bool& verbose=false,
thomas.forbriger's avatar
thomas.forbriger committed
394
                   Ttracelistkey tracekey="t",
395
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
396

397
398
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
    /*! \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
415
416
    TDFileList readDSFF(const tfxx::cmdline::Tparsed& flist,
                        const bool& verbose=false,
thomas.forbriger's avatar
thomas.forbriger committed
417
                        Ttracelistkey tracekey="t",
418
                        const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
419
    
420
421
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
422
423
424
425
426
427
428
429
430
431
432
433
434
435
    /*! \brief read complete SFF file (single precision version).
     *
     * \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
     */
    SFile readSSFF(const std::string& filename,
                   const bool& verbose=false,
436
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
437

438
439
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
    /*! \brief read complete SFF file with trace selection (single precision
     * version).
     *
     * \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
     */
    SFile readSSFF(const std::string& filename,
                   const Ttracelist& selection,
                   const bool& verbose=false,
458
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
459

460
461
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
    /*! \brief read complete SFF file with trace selection (single precision
     * version).
     *
     * \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
     */
    SFile readSSFF(const tfxx::cmdline::Filename& filename,
                   const bool& verbose=false,
                   Ttracelistkey tracekey="t",
482
                   const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
483

484
485
    /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
    /*! \brief read complete list of SFF files with trace selection (single
     * precision version).
     *
     * \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
     */
    TSFileList readSSFF(const tfxx::cmdline::Tparsed& flist,
                        const bool& verbose=false,
                        Ttracelistkey tracekey="t",
506
                        const datrw::Eformat& format=datrw::Fsff);
thomas.forbriger's avatar
thomas.forbriger committed
507

508
509
  } // namespace sff
} // namespace ts
thomas.forbriger's avatar
thomas.forbriger committed
510

511
#endif // TSIO_CMDLINEFILES_H_VERSION (includeguard)
thomas.forbriger's avatar
thomas.forbriger committed
512

513
/* ----- END OF cmdlinefiles.h ----- */