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

◆ open()

void datrw::oanystream::open ( std::ostream &  os,
std::string  format,
const bool &  debug = false 
)
private

actually open stream (to be called by constructor)

Definition at line 81 of file writeany.cc.

References datrw::anyID(), datrw::util::clipstring(), DATRW_abort, DATRW_expect_no_modifier, debug(), datrw::odatstream::debug(), datrw::Fascii, datrw::Fbinary, datrw::Fgse, datrw::Fseife, datrw::Fsff, datrw::Fsu, Mformat, and Mos.

Referenced by oanystream().

83  {
84  std::string formatstring=util::clipstring(format);
85  std::string& modifiers=format;
86  Mformat=anyID(formatstring);
87  if (Mformat==Fsff)
88  {
89  Mos=new osffstream(os, modifiers);
90  }
91  else if (Mformat==Fgse)
92  {
94  Mos=new ogsestream(os);
95  }
96  else if (Mformat==Fsu)
97  {
98  Mos=new osustream(os, modifiers);
99  }
100  else if (Mformat==Fseife)
101  {
102  Mos=new oseifestream(os, modifiers);
103  }
104  else if (Mformat==Fascii)
105  {
106  Mos=new oasciistream(os, modifiers);
107  }
108  else if (Mformat==Fbinary)
109  {
111  Mos=new obinarystream(os);
112  }
113  else
114  {
115  DATRW_abort("ERROR (oanystream): unsupported format!");
116  }
117  Mos->debug(debug);
118  }
datrw::Eformat Mformat
Definition: writeany.h:111
Eformat anyID(std::string formatstring)
convert identifier from and to string representation
Definition: formats.cc:68
datrw::odatstream * Mos
Definition: writeany.h:110
bool debug()
indicate debug mode
Definition: datwrite.h:145
bool debug()
indicate debug mode
Definition: writeany.h:99
#define DATRW_abort(M)
Abort and give a message.
Definition: error.h:101
std::string clipstring(std::string &s, const std::string &delim)
strip substringStrips off first substring up to given delimiter. The string is passed as a reference ...
Definition: util.cc:105
#define DATRW_expect_no_modifier(F, M)
Issue warning if modifiers are passed but not evaluated.
Here is the call graph for this function:
Here is the caller graph for this function: