Fortran SFF API to data I/O streams in C++

◆ open()

datrw::oanystream & fapidxx::OFileUnits::open ( const int &  unit,
const std::string &  filename 
)

open a new file

Definition at line 147 of file fileunit.cc.

References FAPIDXX_fuassert, getstream(), isopen(), Mformat, fapidxx::OFileUnits::OstreamCompound::Moanystream, fapidxx::OFileUnits::OstreamCompound::Mostream, and Mstreammap.

Referenced by sff_wopen__(), sff_wopenfs__(), and sff_wopens__().

149  {
150  FAPIDXX_fuassert((!this->isopen(unit)), unit,
151  "OFileUnits::open: file is already open");
152  OstreamCompound &compound=Mstreammap[unit];
153  datrw::abort_if_exists(filename);
154  compound.Mostream=new std::ofstream(filename.c_str(),
155  datrw::oanystream::openmode(Mformat));
156  compound.Moanystream=new datrw::oanystream(*compound.Mostream, Mformat);
157  return (this->getstream(unit));
158  } // datrw::oanystream& OFileUnits::open
#define FAPIDXX_fuassert(C, U, M)
Check an assertion and report by throwing an exception.
Definition: error.h:205
Tstreammap Mstreammap
place to hold my oanystream objects
Definition: fileunit.h:132
bool isopen(const int &unit) const
check whether a file is opened for this file unit
Definition: fileunit.cc:174
datrw::oanystream & getstream(const int &unit)
return a stream associated with a file unit
Definition: fileunit.cc:183
std::string Mformat
file type to be used
Definition: fileunit.h:130
Here is the call graph for this function:
Here is the caller graph for this function: