DATRW++ library: seismic data I/O with multiple formats

◆ flushwaitingtrace()

void datrw::osffstream::flushwaitingtrace ( const bool &  last = false)
private

flush waiting trace data last true if no other trace will be written, i.e. only set to true when called from destructor

Definition at line 152 of file osffstream.cc.

References DATRW_assert, DATRW_debug, datrw::odatstream::free(), datrw::odatstream::hasfree(), datrw::odatstream::hasinfo(), datrw::odatstream::haswid2(), datrw::odatstream::info(), datrw::odatstream::Mdebug, Mfreeiswaiting, Mfreewaiting, Minfoiswaiting, Minfowaiting, Mnormmode, datrw::odatstream::Mos, Mserieswaiting, Mwid2iswaiting, Mwid2waiting, datrw::odatstream::wid2(), and datrw::sff::writesfftrace().

Referenced by writetrace(), and ~osffstream().

153  {
154  DATRW_debug(Mdebug, "osffstream::flushwaitingtrace",
155  "flush previous trace data to file");
156  // flush previous trace
157  if (Mwid2iswaiting)
158  {
159  // prepare trace header
160  ::sff::TraceHeader traceheader(Mwid2waiting, last);
161  if (Mfreeiswaiting) { traceheader.setfree(Mfreewaiting); }
162  if (Minfoiswaiting) { traceheader.setinfo(Minfowaiting); }
164  traceheader,
166  Mnormmode);
167  }
168  else
169  {
170  DATRW_assert((!last),
171  "file is to be closed and no data was written");
172  }
173  // check for current trace headers and store them
174  if (!last)
175  {
176  DATRW_assert(this->haswid2(), "missing trace header data");
177  Mwid2iswaiting=true;
178  Mwid2waiting=this->wid2();
179  Mfreeiswaiting=false;
180  if (this->hasfree()) { Mfreeiswaiting=true; Mfreewaiting=this->free(); }
181  Minfoiswaiting=false;
182  if (this->hasinfo()) { Minfoiswaiting=true; Minfowaiting=this->info(); }
183  }
184  }
bool Minfoiswaiting
Definition: sff.h:120
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
bool hasinfo() const
info is available
Definition: datwrite.h:182
sff::WID2 wid2() const
return WID2 data
Definition: datwrite.h:169
::sff::WID2 Mwid2waiting
Definition: sff.h:121
bool Mfreeiswaiting
Definition: sff.h:120
std::ostream & Mos
output stream to be used by this class
Definition: datwrite.h:194
bool haswid2() const
wid2 is available
Definition: datwrite.h:178
::sff::FREE Mfreewaiting
Definition: sff.h:122
::sff::INFO Minfowaiting
Definition: sff.h:123
sff::INFO info() const
return SRCE data
Definition: datwrite.h:173
sff::FREE free() const
return FREE data
Definition: datwrite.h:175
void writesfftrace(std::ostream &os, const ::sff::TraceHeader &traceheader, const datrw::util::seriesreservoir &series, const ::sff::Enormmode &normmode)
function to write an SFF trace from a series reservoir
Definition: sffwriters.cc:45
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
::sff::Enormmode Mnormmode
Definition: sff.h:127
bool Mdebug
global debug flag
Definition: datwrite.h:197
datrw::util::seriesreservoir Mserieswaiting
Definition: sff.h:124
bool Mwid2iswaiting
Definition: sff.h:120
bool hasfree() const
free is available
Definition: datwrite.h:184
Here is the call graph for this function:
Here is the caller graph for this function: