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

◆ readfile()

Tvecofblocks datrw::hpmo::readfile ( std::istream &  is,
const bool &  verbose 
)

read a full data file

Definition at line 216 of file readhpmo.cc.

References datrw::Exception::dont_report_on_construct(), datrw::Exception::report(), and datrw::Exception::report_on_construct_flag().

Referenced by main(), and datrw::ihpmostream::read().

217  {
218  Tvecofblocks retval;
219  bool hot=true;
220  MinuteBlock block;
221  retval.clear();
222  if (verbose) { std::cout << "extracting block # "; }
223  int iblock=0;
224  while (is.good() && (hot))
225  {
227  Exception::dont_report_on_construct();
228  try { is >> block; }
229  catch ( NoHeaderException )
230  { hot=false; }
231  catch ( Exception& e )
232  {
233  e.report();
234  std::cerr << "ERROR (datrw::hpmo::read): "
235  << "after reading " << retval.size() << " blocks"
236  << std::endl;
237  if (retval.size()>0)
238  {
239  std::cerr << " last successfull block @ "
240  << retval[retval.size()-1].Mtime.timestring() << std::endl;
241  }
242  throw;
243  }
245  if (hot)
246  {
247  retval.push_back(block);
248  if (verbose) { std::cout << ++iblock << " "; }
249  }
250  }
251  if (verbose) { std::cout << std::endl; }
252  return(retval);
253  } // Tvecofblocks readfile(std::istream& is, const bool& verbose)
std::vector< MinuteBlock > Tvecofblocks
within the inner reading functions, we use vector to hold minute blocks
Definition: readhpmo.h:67
static bool report_on_construct_flag()
return report on construct flag
Definition: exception.h:93
Here is the call graph for this function:
Here is the caller graph for this function: