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

◆ readasciidouble()

template<class C >
C datrw::util::readasciidouble ( std::istream &  is,
const int  nsamples,
const std::string &  streamname 
)

read the trace data

Parameters
isthe input stream
nsamplesthe number of samples
streamnamename of the stream for Exceptions
Returns
the trace

Definition at line 141 of file util.h.

References DATRW_assert, datrw::hpmo::nsamples, and datrw::tfascii::streamname.

143  {
144  std::string errorstr = "ERROR ("+streamname+
145  "::?series): number of samples is not positive!";
146  DATRW_assert(nsamples>0, errorstr.c_str());
147  C series(nsamples);
148  double inval;
149  errorstr = "ERROR ("+streamname+"::?series): bad stream!";
150  ::datrw::report_conversion<double, typename C::Tvalue>(std::cout);
151  for (int i = 0; i < nsamples; ++i)
152  {
153  DATRW_assert(is.good(), errorstr.c_str());
154  is >> inval;
155  series(i) = static_cast<typename C::Tvalue>(inval);
156  }
157  return series;
158  } // template function readascii
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
const char *const streamname
name of the stream
Definition: readtfascii.cc:75
const int nsamples
number of samples per minute block and channel
Definition: hpmodata.h:51
int Tvalue
Definition: pdasread.h:75