SFF++ library: reading and writing SFF from C++

◆ read()

void sff::SRCE::read ( std::istream &  is,
const bool &  debug = false 
)

Definition at line 377 of file sffxx.cc.

References sff::coosysID(), cs, cx, cy, cz, date, and type.

Referenced by sff::FileHeader::read(), and SRCE().

378  {
379  std::string theline;
380  std::getline(fis, theline);
381 
382  std::string lineID=theline.substr(0,4);
383  if (!helper::IDmatch<SRCE>(lineID)) throw
384  GSE2::Terror("ERROR (SRCE::read): missing SRCE ID!");
385 
386  this->type=theline.substr(5,20);
387  if (debug)
388  { std::cerr << "DEBUG (SRCE::read): type: " << type << std::endl; }
389 
390  this->cs=coosysID(*theline.substr(26,1).c_str());
391  this->cx=atof(theline.substr(28,15).c_str());
392  this->cy=atof(theline.substr(43,15).c_str());
393  this->cz=atof(theline.substr(58,15).c_str());
394  if (debug)
395  {
396  std::cerr << "DEBUG (SRCE::read): cs,cx,cy,cz: "
397  << coosysID(cs) << "," << cx << "," << cy << "," << cz << std::endl;
398  }
399 
400  std::string datestring,timestring;
401  datestring=theline.substr(74,6);
402  timestring=theline.substr(81,10);
403  if (debug)
404  {
405  std::cerr << "DEBUG (SRCE::read): datestring: "
406  << datestring << std::endl;
407  std::cerr << "DEBUG (SRCE::read): timestring: "
408  << timestring << std::endl;
409  }
410  std::string fulldate("");
411  fulldate+=datestring.substr(0,2);
412  fulldate+="/";
413  fulldate+=datestring.substr(2,2);
414  fulldate+="/";
415  fulldate+=datestring.substr(4,2);
416  fulldate+=" ";
417  fulldate+=timestring.substr(0,2);
418  fulldate+=":";
419  fulldate+=timestring.substr(2,2);
420  fulldate+=":";
421  fulldate+=timestring.substr(4,6);
422  if (debug)
423  {
424  std::cerr << "DEBUG (SRCE::read): convert string: "
425  << fulldate << std::endl;
426  }
427  this->date=libtime::TAbsoluteTime(fulldate);
428  if (debug)
429  {
430  std::cerr << "DEBUG (SRCE::read): time: "
431  << date.timestring() << std::endl;
432  }
433  } // void SRCE::read(std::istream& fis, const bool& debug)
char coosysID(const Ecoosys &csid)
Definition: sffxx.cc:145
double cz
Definition: sffxx.h:176
std::string type
Definition: sffxx.h:173
Ecoosys cs
Definition: sffxx.h:175
libtime::TAbsoluteTime date
time of source
Definition: sffxx.h:174
double cx
Definition: sffxx.h:176
double cy
Definition: sffxx.h:176
Here is the call graph for this function:
Here is the caller graph for this function: