Fortran SFF API to data I/O streams in C++
fapid_sff_wopens.cc
Go to the documentation of this file.
1 
34 #define TF_FAPID_SFF_WOPENS_CC_VERSION \
35  "TF_FAPID_SFF_WOPENS_CC V1.0 "
36 
37 #include <fapidxx/fapidsff.h>
38 #include <fapidxx/fileunit.h>
39 #include <fapidxx/helper.h>
40 #include <fapidxx/error.h>
41 #include <sffxx.h>
42 
43 using namespace fapidxx;
44 
70 int sff_wopens__(integer *lu, char *filename, char *type__, char *cs,
71  real *c1, real *c2, real *c3, char *date, char *time,
72  integer *ierr, ftnlen filename_len, ftnlen type_len,
73  ftnlen cs_len, ftnlen date_len, ftnlen time_len)
74 {
75  int retval=0;
76  *ierr=0;
77  try {
78  datrw::oanystream &os=
79  ostreammanager.open(static_cast<int>(*lu),
80  stringfromfstring(filename, filename_len));
81  if (os.handlessrce())
82  {
83  sff::SRCE srce;
84  srce.cs=sff::coosysID(*cs);
85  srce.cx=static_cast<double>(*c1);
86  srce.cy=static_cast<double>(*c2);
87  srce.cz=static_cast<double>(*c3);
88  srce.type=stringfromfstring(type__, type_len);
89  srce.date=SRCEdate(date, time, date_len, time_len);
90  os << srce;
91  }
92  }
93  catch (...) {
94  *ierr=1;
95  }
96  return(retval);
97 } // int sff_wopens__
98 
99 /* ----- END OF fapid_sff_wopens.cc ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
Definition: error.cc:44
long int integer
Fortran integer type.
Definition: fapidsff.h:66
datrw::oanystream & open(const int &unit, const std::string &filename)
open a new file
Definition: fileunit.cc:147
libtime::TAbsoluteTime SRCEdate(char *date, char *time, ftnlen date_len, ftnlen time_len)
create appropriate time string for SRCE line
Definition: helper.cc:127
int sff_wopens__(integer *lu, char *filename, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
Open file for writing and pass SRCE line.
exceptions and error handling macros (prototypes)
float real
Fortran real type (single precision)
Definition: fapidsff.h:73
::fapidxx::OFileUnits ostreammanager
the global ostream manager
Definition: fileunit.cc:51
long int ftnlen
Fortran string size type.
Definition: fapidsff.h:70
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
Definition: helper.cc:51
a file unit interface to libdatrwxx (prototypes)
some helper functions (prototypes)