sffistream.h 2.44 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file sffistream.h
 * \brief SFF input stream (prototypes)
 * 
 * ----------------------------------------------------------------------------
 * 
thomas.forbriger's avatar
thomas.forbriger committed
6
 * $Id: sffistream.h,v 1.2 2004-02-19 16:15:57 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * \author Thomas Forbriger
 * \date 10/02/2004
 * 
 * SFF input stream (prototypes)
 * 
 * Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach) 
 * 
 * REVISIONS and CHANGES 
 *  - 10/02/2004   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */

// include guard
#ifndef TF_SFFISTREAM_H_VERSION

#define TF_SFFISTREAM_H_VERSION \
  "TF_SFFISTREAM_H   V1.0   "
#define TF_SFFISTREAM_H_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
26
  "$Id: sffistream.h,v 1.2 2004-02-19 16:15:57 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
27

thomas.forbriger's avatar
thomas.forbriger committed
28
29
30
#include<sffxx.h>
#include<iostream>
#include<new>
thomas.forbriger's avatar
thomas.forbriger committed
31

thomas.forbriger's avatar
thomas.forbriger committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
namespace sff {

  namespace helper {

    class istream_manager {
      public:
        istream_manager(std::istream& is);
        const TraceHeader& traceheader() const;
        const FileHeader& fileheader() const;
        const INFO& info() const;
        const WID2& wid2() const;
        const FREE& filefree() const;
        const FREE& tracefree() const;
        const SRCE& srce() const;
        bool hassrce() const;
        bool hasfilefree() const;
        bool hastracefree() const;
        bool hasinfo() const;
        bool last() const;
        bool good() const;
        void skip() const;
      protected:
        void settraceheader(const TraceHeader& th);
        std::istream& Mis;
      private:
        FileHeader Mfileheader;
        TraceHeader Mtraceheader;
    }; // class istream_manager

  } // namespace helper

  //! SFF input stream
  template<class C>
    class SFFistream: public helper::istream_manager {
      public:
        typedef C Tseries;
        typedef typename C::Tcoc Tcseries;
        typedef helper::istream_manager Tbase;
        SFFistream(std::istream& is): 
          Tbase(is) { read(); }
        void skip()
        {
          Mseries=Tseries();
          Tbase::skip();
        }
        Tseries series() const
        {
          if (this->Tbase::good()) { read(); }
          return (Mseries);
        }
      private:
        void read()
        {
          InputWaveform<Tseries> waveform(Mis);
          Tbase::settraceheader(waveform.header());
          Mseries=waveform.series();
        }
        Tseries Mseries;
    }; // class SFFistream

} // namespace helper
thomas.forbriger's avatar
thomas.forbriger committed
93
94
95
96

#endif // TF_SFFISTREAM_H_VERSION (includeguard)

/* ----- END OF sffistream.h ----- */