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

◆ ibinarystream()

datrw::ibinarystream::ibinarystream ( std::istream &  is,
const bool &  debug = false 
)

Definition at line 51 of file ibinarystream.cc.

References datrw::binary::checkfileflags(), DATRW_assert, DATRW_debug, datrw::binary::Ffree, datrw::idatstream::free(), datrw::binary::Fsrce, datrw::idatstream::Mdebug, Mibs, datrw::idatstream::Mis, Mnextflags, Mversion, datrw::idatstream::setfilefree(), datrw::idatstream::setsrce(), datrw::idatstream::srce(), and datrw::binary::version.

52  :
53  Tbase(is, true, true, true, debug),
55  {
56  char flags;
57  Mibs >> Mversion;
58  DATRW_debug(Mdebug, "ibinarystream::ibinarystream",
59  "file version " << Mversion);
61  {
62  std::cerr << "*** library version: " << datrw::binary::version <<
63  std::endl;
64  std::cerr << "*** file version: " << Mversion << std::endl;
65  }
67  "ERROR: file version does not match library version");
68  Mibs >> flags;
70  if (flags & ::datrw::binary::Fsrce)
71  {
72  DATRW_debug(Mdebug, "ibinarystream::ibinarystream",
73  "reading SRCE line");
74  ::sff::SRCE srce;
75  Mibs >> srce;
76  this->setsrce(srce);
77  }
78  if (flags & ::datrw::binary::Ffree)
79  {
80  ::sff::FREE free;
81  Mibs >> free;
82  this->setfilefree(free);
83  DATRW_debug(Mdebug, "ibinarystream::ibinarystream",
84  "reading file FREE block");
85  }
86  Mibs >> Mnextflags;
87  DATRW_assert(Mis.good(),
88  "ERROR: could not read behind file header");
90  } // ibinarystream::ibinarystream
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
void checkfileflags(const char &flags)
abort if file flags are inconsistent
Definition: binary.cc:58
void setfilefree(const sff::FREE &free)
Definition: datread.cc:97
const char *const magic
magic number to identify file type and bytesex
Definition: binary.cc:53
void setsrce(const sff::SRCE &srce)
Definition: datread.cc:129
std::istream & Mis
Definition: datread.h:126
idatstream Tbase
Definition: binary.h:106
trace has SRCE header
Definition: binary.h:79
const short version
a version number for files - just in case
Definition: binary.cc:54
bool debug()
indicate debug mode
Definition: datread.h:116
sff::SRCE srce() const
Definition: datread.h:109
sff::FREE free() const
Definition: datread.cc:79
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
char Mnextflags
flags for next trace
Definition: binary.h:121
trace has FREE header
Definition: binary.h:80
binary::ibinstream Mibs
Definition: binary.h:119
Here is the call graph for this function: