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

◆ readheader()

void datrw::hpmo::Header::readheader ( std::istream &  is,
const bool &  verbose = false 
)

Definition at line 47 of file readhpmo.cc.

References DATRW_assert, Merrorflag, Mline, and Mtime.

Referenced by Header(), and datrw::hpmo::operator>>().

48  {
49  std::getline(is, this->Mline);
50  if (Mline.length() != 45) { throw NoHeaderException(); }
51  if (verbose) { std::cout << Mline << std::endl; }
52  std::string secstring=Mline.substr(17,2);
53  DATRW_assert((secstring=="57"), "illegal second!");
54  std::string timestring;
55  const std::string sep("/");
56  timestring=Mline.substr(6,4)+sep+Mline.substr(0,2)+sep+
57  Mline.substr(3,2)+sep+Mline.substr(11,8);
58  if (verbose) { std::cout << timestring << std::endl; }
59  Mtime=libtime::TAbsoluteTime(timestring);
60  if (verbose) { std::cout << Mtime.timestring() << std::endl; }
61  std::string timezone=Mline.substr(23,3);
62  if (verbose) { std::cout << timezone << std::endl; }
63  DATRW_assert((timezone == std::string("UTC")),
64  "unexpected time code string!");
65  std::string errorcode=Mline.substr(34,1);
66  if (verbose) { std::cout << errorcode << std::endl; }
67  Merrorflag=atoi(errorcode.c_str());
68  if (verbose) { std::cout << Merrorflag << std::endl; }
69  } // Header::readheader(std::istream& is)
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
std::string Mline
Definition: readhpmo.h:102
libtime::TAbsoluteTime Mtime
Definition: readhpmo.h:100
Here is the caller graph for this function: