GSE++ library: reading and writing GSE waveforms

◆ convert()

std::string GSE2::waveform::TDAT2writeCM6::convert ( const intT value)
privatevirtual

put to stream: user must define

Implementation class specific put function. The function takes second differences, encodes the resulting value and writes the characters to the output stream.

Parameters
valueinteger value (not difference value) to write.

Implements GSE2::waveform::TDAT2write.

Definition at line 308 of file gsexx_TDAT2.cc.

References GSE2::waveform::CM6::encode(), Mapplydiff, GSE2::waveform::TDAT2write::Mcpos, GSE2::waveform::TDAT2write::Mlinelength, and GSE2::waveform::differences::Tdiff_operator< n, OP >::report_status().

309 {
310  std::string charcode;
311  try {
312  charcode=CM6::encode(Mapplydiff(value));
313  }
314  catch (Terror e)
315  {
316  std::cerr.setf(std::ios_base::dec,std::ios_base::basefield);
317  std::cerr << "TDAT2writeCM6::convert caught exception" << std::endl;
318  Mapplydiff.report_status(std::cerr);
319  std::cerr << "current value: " << value << std::endl;
320  throw e;
321  }
322  std::string retval;
323  // iterate through all characters
324  for (std::string::const_iterator c=charcode.begin(); c!=charcode.end(); c++)
325  {
326  // next line if full
327  if (Mlinelength <= Mcpos)
328  {
329  retval+='\n';
330  Mcpos=0;
331  }
332  retval+=*c;
333  Mcpos++;
334  }
335  return(retval);
336 }
std::string encode(const intT &invalue)
CM6 subformat encoding function.
Definition: gsexx_cm6.cc:77
intT Mcpos
character position in line
Definition: gsexx.h:369
void report_status(std::ostream &os) const
report status (for debugging)
Definition: gsexx.h:247
intT Mlinelength
linelength in output file
Definition: gsexx.h:367
apply2nddiffT Mapplydiff
only compression formats apply differences.
Definition: gsexx.h:407
Here is the call graph for this function: