TSIO++ Time series input/output
outputoperators.h
Go to the documentation of this file.
1 
39 // include guard
40 #ifndef TSIO_OUTPUTOPERATORS_H_VERSION
41 
42 #define TSIO_OUTPUTOPERATORS_H_VERSION \
43  "TF_OUTPUTOPERATORS_H 2014/01/30"
44 
45 #include<tsioxx/sfftsfile.h>
46 #include<datrwxx/datwrite.h>
47 
48 namespace ts {
49 
50  namespace sff {
51 
60  /*======================================================================*/
61  // libdatrwxx output operators
62 
63  inline
64  datrw::odatstream& operator<<(datrw::odatstream& os,
65  const FileHeader& fh)
66  {
67  if (fh.hasfree()) { os << fh.free(); }
68  if (fh.hassrce()) { os << fh.srce(); }
69  return os;
70  }
71 
72  /*----------------------------------------------------------------------*/
73 
74  inline
75  datrw::odatstream& operator<<(datrw::odatstream& os,
76  const TraceHeader& th)
77  {
78  os << th.wid2();
79  if (th.hasfree()) { os << th.free(); }
80  if (th.hasinfo()) { os << th.info(); }
81  return os;
82  }
83 
84  /*----------------------------------------------------------------------*/
85 
90  template<class C>
91  datrw::odatstream& operator<<(datrw::odatstream& os,
92  const typename SFFTimeSeries<C>::Tconsttimeseries& s)
93  {
94  typedef typename SFFTimeSeries<C>::Tconsttimeseries::Tseries Tseries;
95  return(os << s.header << Tseries(s));
96  }
97 
98  /*----------------------------------------------------------------------*/
99 
100  template<class C>
101  datrw::odatstream& operator<<(datrw::odatstream& os,
102  const SFFTimeSeries<C>& s)
103  {
104  typedef typename SFFTimeSeries<C>::Tcoc Tcoc;
105  return(os << s.header << Tcoc(s));
106  }
107 
108  /*----------------------------------------------------------------------*/
109 
110  template<class C>
111  datrw::odatstream& operator<<(datrw::odatstream& os,
112  const TraceVector<C>& tv)
113  {
114  typedef TraceVector<C> Ttracevector;
115  for(typename Ttracevector::const_iterator i=tv.begin();
116  i != tv.end(); ++i)
117  { os << *i; }
118  return os;
119  }
120 
121  /*----------------------------------------------------------------------*/
122 
123  template<class C>
124  datrw::odatstream& operator<<(datrw::odatstream& os,
125  const File<C>& f)
126  { return(os << f.fileheader << TraceVector<C>(f)); }
127 
132  } // namespace sff
133 } // namespace ts
134 
135 #endif // TSIO_OUTPUTOPERATORS_H_VERSION (includeguard)
136 
137 /* ----- END OF outputoperators.h ----- */
Tbase::Tconsttimeseries Tconsttimeseries
Definition: sfftimeseries.h:87
hold SFF traces with full header information
Definition: tracevector.h:51
hold all information contained in an SFF data file
Definition: sfftsfile.h:66
bool hasfree() const
Definition: fileheader.h:57
FileHeader fileheader
Definition: sfftsfile.h:77
bool hassrce() const
Definition: fileheader.h:58
bool hasinfo() const
Definition: traceheader.h:60
hold a full SFF trace and provide conversion
Definition: sfftimeseries.h:71
hold information for a complete SFF trace header
Definition: traceheader.h:49
Outer namespace.
Definition: cmdlinefiles.cc:46
hold information for a complete SFF file header
Definition: fileheader.h:49
void free(const ::sff::FREE &f)
Definition: traceheader.cc:52
void info(const ::sff::INFO &s)
Definition: traceheader.cc:46
void free(const ::sff::FREE &f)
Definition: fileheader.cc:52
datrw::odatstream & operator<<(datrw::odatstream &os, const FileHeader &fh)
void srce(const ::sff::SRCE &s)
Definition: fileheader.cc:46
void wid2(const ::sff::WID2 &w)
Definition: traceheader.h:54
data file container for SFF TimeSeries (prototypes)
bool hasfree() const
Definition: traceheader.h:59