sff.h 3.48 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file sff.h
 * \brief wrapper around SFF output stream (prototypes)
 * 
 * ----------------------------------------------------------------------------
 * 
6
 * $Id: sff.h,v 1.11 2010-04-30 19:59:35 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
 * \author Thomas Forbriger
 * \date 11/04/2006
 * 
 * wrapper around SFF output stream (prototypes)
 * 
 * Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach) 
thomas.forbriger's avatar
thomas.forbriger committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 *
 * ----
 * 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
30
31
32
33
34
35
36
37
 * 
 * REVISIONS and CHANGES 
 *  - 11/04/2006   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */

// include guard
thomas.forbriger's avatar
thomas.forbriger committed
38
#ifndef DATWRITE_SFF_H_VERSION
thomas.forbriger's avatar
thomas.forbriger committed
39

thomas.forbriger's avatar
thomas.forbriger committed
40
#define DATWRITE_SFF_H_VERSION \
thomas.forbriger's avatar
thomas.forbriger committed
41
  "TF_SFF_H   V1.0   "
thomas.forbriger's avatar
thomas.forbriger committed
42
#define DATWRITE_SFF_H_CVSID \
43
  "$Id: sff.h,v 1.11 2010-04-30 19:59:35 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
44
45

#include<datwritexx/datwrite.h>
thomas.forbriger's avatar
thomas.forbriger committed
46
#include<datwritexx/reservoir.h>
thomas.forbriger's avatar
thomas.forbriger committed
47
#include<sffxx.h>
thomas.forbriger's avatar
thomas.forbriger committed
48

thomas.forbriger's avatar
thomas.forbriger committed
49
namespace datwrite {
thomas.forbriger's avatar
thomas.forbriger committed
50

51
  /*! \brief SFF writing interface
thomas.forbriger's avatar
thomas.forbriger committed
52
53
54
   *
   * \defgroup sff Write SFF and GSE data
   */
thomas.forbriger's avatar
thomas.forbriger committed
55

thomas.forbriger's avatar
thomas.forbriger committed
56
57
58
59
  /*! \brief class to write SFF data
   *
   * \ingroup sff
   */
thomas.forbriger's avatar
thomas.forbriger committed
60
  class osffstream: public odatstream {
thomas.forbriger's avatar
thomas.forbriger committed
61
62
63
    public:
      typedef odatstream Tbase;
      osffstream(std::ostream& os, const bool& debug=false);
thomas.forbriger's avatar
thomas.forbriger committed
64
      inline virtual ~osffstream() 
thomas.forbriger's avatar
thomas.forbriger committed
65
      { this->flushwaitingtrace(true); }
thomas.forbriger's avatar
thomas.forbriger committed
66
      static void help(std::ostream& os=std::cout);
thomas.forbriger's avatar
thomas.forbriger committed
67
68
69
70
71
72
    protected:
      virtual void writefileheader();
      virtual void writetrace(const Tdseries& series);
      virtual void writetrace(const Tfseries& series);
      virtual void writetrace(const Tiseries& series);
    private:
thomas.forbriger's avatar
thomas.forbriger committed
73
74
75
76
77
78
      /*! flush waiting trace data
       * \PARAM last true if no other trace will be written,
       *             i.e. only set to true when called from destructor
       */
      void flushwaitingtrace(const bool& last=false);

thomas.forbriger's avatar
thomas.forbriger committed
79
    protected:
thomas.forbriger's avatar
thomas.forbriger committed
80
      bool Mdebug;
thomas.forbriger's avatar
thomas.forbriger committed
81
    private:
thomas.forbriger's avatar
thomas.forbriger committed
82
      bool Mwid2iswaiting, Mfreeiswaiting, Minfoiswaiting;
thomas.forbriger's avatar
thomas.forbriger committed
83
84
85
86
      sff::WID2 Mwid2waiting;
      sff::FREE Mfreewaiting;
      sff::INFO Minfowaiting;
      datwrite::util::seriesreservoir Mserieswaiting;
thomas.forbriger's avatar
thomas.forbriger committed
87
88
89

    protected:
      ::sff::Enormmode Mnormmode;
thomas.forbriger's avatar
thomas.forbriger committed
90
91
92
93
94
95
96
97
  }; // class osffstream

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

  /*! \brief class to write GSE data
   *
   * \ingroup sff
   */
thomas.forbriger's avatar
thomas.forbriger committed
98
  class ogsestream: public osffstream {
thomas.forbriger's avatar
thomas.forbriger committed
99
    public:
thomas.forbriger's avatar
thomas.forbriger committed
100
      typedef osffstream Tbase;
thomas.forbriger's avatar
thomas.forbriger committed
101
      ogsestream(std::ostream& os, const bool& debug=false);
thomas.forbriger's avatar
thomas.forbriger committed
102
103
104
      inline virtual ~ogsestream() { }
      static void help(std::ostream& os=std::cout);
      /*
thomas.forbriger's avatar
thomas.forbriger committed
105
    protected:
thomas.forbriger's avatar
thomas.forbriger committed
106
107
108
109
110
      virtual void writetrace(const Tdseries& series) 
      { DATWRITE_abort("ogsestream cannot write doubles"); }
      virtual void writetrace(const Tfseries& series) 
      { DATWRITE_abort("ogsestream cannot write floats"); }
      */
thomas.forbriger's avatar
thomas.forbriger committed
111
112
113
114
115
  }; // class ogsestream

} // namespace datwrite

#endif // DATWRITE_SFF_H_VERSION (includeguard)
thomas.forbriger's avatar
thomas.forbriger committed
116
117

/* ----- END OF sff.h ----- */