Fortran SFF API to data I/O streams in C++
helper.h
Go to the documentation of this file.
1 
40 // include guard
41 #ifndef FAPIDXX_HELPER_H_VERSION
42 
43 #define FAPIDXX_HELPER_H_VERSION \
44  "FAPIDXX_HELPER_H V1.4"
45 
46 #include<string>
47 #include<iostream>
48 #include<libtime++.h>
49 #include<sffxx.h>
50 #include<fapidxx/fapidsff.h>
51 
52 namespace fapidxx {
53 
55  std::string stringfromfstring(char *fstring, ftnlen slen);
56 
58  void fillfstring(const std::string& s, char *fstring, ftnlen slen);
59 
61  std::string trimws_end(std::string s);
62 
64  std::string trimws(std::string s);
65 
67  float maketanf(const libtime::TAbsoluteTime& time);
68 
70  libtime::TAbsoluteTime SRCEdate(char *date, char* time,
71  ftnlen date_len, ftnlen time_len);
72 
74  ::sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len);
75 
77  void freeblock(const ::sff::FREE& free,
78  integer *nline, char *lines, integer *lindim,
79  integer *lenmax, ftnlen lines_len);
80 
81 } // namespace fapidxx
82 
83 /*======================================================================*/
84 
92 #define FAPIDXX_debug(C,N,M) \
93  if (C) { \
94  std::cerr << "DEBUG (" << N << ", " \
95  << __FILE__ << " line #" << __LINE__ << "):" << std::endl \
96  << " " << M << std::endl; \
97  std::cerr.flush(); \
98  }
99 
100 /*======================================================================*/
101 // functions with Fortran interface
102 
103 extern "C" {
104 
116 extern int sff_helper_decode_wid2__(char *wid2in, char *wid2out,
117  ftnlen wid2in_len, ftnlen wid2out_len);
118 
119 } // extern "C"
120 
121 #endif // FAPIDXX_HELPER_H_VERSION (includeguard)
122 
123 /* ----- END OF helper.h ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
Definition: error.cc:44
sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len)
create C++ FREE block from Fortran FREE lines
Definition: helper.cc:150
long int integer
Fortran integer type.
Definition: fapidsff.h:66
libtime::TAbsoluteTime SRCEdate(char *date, char *time, ftnlen date_len, ftnlen time_len)
create appropriate time string for SRCE line
Definition: helper.cc:127
void fillfstring(const std::string &s, char *fstring, ftnlen slen)
fill a Fortran string with a C++ string
Definition: helper.cc:60
std::string trimws(std::string s)
remove whitespace at begin and end of string
Definition: helper.cc:82
std::string trimws_end(std::string s)
remove whitespace at end of string
Definition: helper.cc:105
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
float maketanf(const libtime::TAbsoluteTime &time)
create the tanf value
Definition: helper.cc:118
int sff_helper_decode_wid2__(char *wid2in, char *wid2out, ftnlen wid2in_len, ftnlen wid2out_len)
decode a WID2 character sequence