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

◆ writetrace() [2/3]

void datrw::osustream::writetrace ( const Tfseries::Tcoc &  series)
protectedvirtual

actually write trace data

Reimplemented from datrw::odatstream.

Definition at line 144 of file osustream.cc.

References DATRW_debug, datrw::odatstream::hasinfo(), datrw::odatstream::hassrce(), datrw::odatstream::info(), datrw::odatstream::Mdebug, datrw::su::SUheader::Mheader, Mheadercontrol, Mitrace, datrw::odatstream::Mos, datrw::su::SUheader::set(), datrw::odatstream::srce(), datrw::su::TraceHeaderStruct::tracr, datrw::odatstream::wid2(), and datrw::su::SUheader::write().

145  {
146  DATRW_debug(Mdebug, "osustream::writetrace(const Tfseries& series)",
147  "actually write trace");
148  ++Mitrace;
150  ::sff::WID2 wid2=this->wid2();
151  wid2.nsamples=series.size();
152  header.set(wid2);
153  ::sff::SRCE srce=this->srce();
154  if (!this->hassrce())
155  {
156  // prepare SRCE data from wid2 data
157  srce.date=wid2.date;
158  }
159  ::sff::INFO info=this->info();
160  if (!this->hasinfo())
161  {
162  // prepare INFO data from
163  info.cx=static_cast<double>(Mitrace);
164  }
165  header.set(srce);
166  header.set(info);
167  header.Mheader.tracr=Mitrace;
168  header.write(Mos);
169  // write samples to file
170  Mos.write(reinterpret_cast<const char *>(series.pointer()),
171  series.size()*sizeof(Tfseries::Tvalue));
172  DATRW_debug(Mdebug, "osustream::writetrace(const Tfseries& series)",
173  "wrote " << series.size() << " samples of "
174  << sizeof(Tfseries::Tvalue) << " bytes size; "
175  << "Mos.good() returns " << Mos.good());
176  } // void osustream::writetrace(const Tfseries& series)
bool hasinfo() const
info is available
Definition: datwrite.h:182
unsigned int Mitrace
Definition: su.h:115
bool hassrce() const
srce is available
Definition: datwrite.h:180
sff::WID2 wid2() const
return WID2 data
Definition: datwrite.h:169
C++ class to handle Seismic Un*x header struct.
Definition: suheader.h:123
std::ostream & Mos
output stream to be used by this class
Definition: datwrite.h:194
sff::INFO info() const
return SRCE data
Definition: datwrite.h:173
int Tvalue
Definition: pdasread.h:75
sff::SRCE srce() const
return SRCE data
Definition: datwrite.h:171
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
bool Mdebug
global debug flag
Definition: datwrite.h:197
datrw::su::options::SUHeaderControl Mheadercontrol
Definition: su.h:116
Here is the call graph for this function: