Fortran SFF API to data I/O streams in C++
fapid_sff_select_format.cc
Go to the documentation of this file.
1 
36 #define TF_SFF_SELECT_FORMAT_CC_VERSION \
37  "TF_SFF_SELECT_FORMAT_CC V1.1"
38 
39 #include <fapidxx/fapidsff.h>
40 #include <fapidxx/helper.h>
41 #include <fapidxx/fileunit.h>
42 #include <datrwxx/formats.h>
43 #include <datrwxx/error.h>
44 
45 using namespace fapidxx;
46 
51 int sff_select_format__(char *formatid, integer *ierr,
52  ftnlen formatid_len)
53 {
54  std::string formatstring=stringfromfstring(formatid, formatid_len);
55  *ierr=0;
56  try {
57  istreammanager.setformat(formatstring);
58  ostreammanager.setformat(formatstring);
59  } catch (datrw::Exception) {
60  *ierr=1;
61  }
62  return(0);
63 } // int sff_select_format__
64 
65 /*----------------------------------------------------------------------*/
66 
71 int sff_select_input_format__(char *formatid, integer *ierr,
72  ftnlen formatid_len)
73 {
74  std::string formatstring=stringfromfstring(formatid, formatid_len);
75  *ierr=0;
76  try {
77  istreammanager.setformat(formatstring);
78  } catch (datrw::Exception) {
79  *ierr=1;
80  }
81  return(0);
82 } // int sff_select_input_format__
83 
84 /*----------------------------------------------------------------------*/
85 
90 int sff_select_output_format__(char *formatid, integer *ierr,
91  ftnlen formatid_len)
92 {
93  std::string formatstring=stringfromfstring(formatid, formatid_len);
94  *ierr=0;
95  try {
96  ostreammanager.setformat(formatstring);
97  } catch (datrw::Exception) {
98  *ierr=1;
99  }
100  return(0);
101 } // int sff_select_output_format__
102 
103 /* ----- END OF fapid_sff_select_format.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
void setformat(const std::string &format)
set file format to be used upon file open
Definition: fileunit.cc:121
int sff_select_output_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for output
int sff_select_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for input and output
int sff_select_input_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for input
void setformat(const std::string &format)
set file format to be used upon file open
Definition: fileunit.cc:192
::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)
::fapidxx::IFileUnits istreammanager
the global istream manager
Definition: fileunit.cc:48
some helper functions (prototypes)