Fortran SFF API to data I/O streams in C++
fapid_sff_prepwid2.cc
Go to the documentation of this file.
1 
34 #define TF_FAPID_SFF_PREPWID2_CC_VERSION \
35  "TF_FAPID_SFF_PREPWID2_CC V1.0 "
36 
37 #include <fapidxx/fapidsff.h>
38 #include <fapidxx/helper.h>
39 #include <fapidxx/wid2container.h>
40 #include <fapidxx/error.h>
41 
90 int sff_prepwid2__(integer *nsamp, real *samprat, char *station,
91  integer *year, integer *month, integer *day,
92  integer *hour, integer *minute, char *comp,
93  char *auxid, char *instyp, real *second, real *calib,
94  real *calper, real *hang, real *vang, char *wid2line,
95  integer *ierr, ftnlen station_len, ftnlen comp_len,
96  ftnlen auxid_len, ftnlen instyp_len, ftnlen wid2line_len)
97 {
98  ::sff::WID2 wid2;
99  wid2.nsamples= *nsamp;
100  wid2.dt = 1./(*samprat);
101  wid2.station =fapidxx::stringfromfstring(station, station_len);
102  double dsecond=*second;
103  libtime::timeint isecond=static_cast<libtime::timeint>(std::floor(dsecond));
104  libtime::timeint milsec
105  =static_cast<libtime::timeint>(std::floor(1.e3*dsecond));
106  libtime::timeint micsec
107  =static_cast<libtime::timeint>(std::floor(1.e6*dsecond));
108  milsec -= 1000*isecond;
109  micsec -= 1000*(milsec+1000*isecond);
110  libtime::TAbsoluteTime date(*year, *month, *day, *hour, *minute,
111  isecond, milsec, micsec);
112  wid2.date =date;
113  wid2.channel =fapidxx::stringfromfstring(comp, comp_len);
114  wid2.auxid =fapidxx::stringfromfstring(auxid, auxid_len);
115  wid2.instype =fapidxx::stringfromfstring(instyp, instyp_len);
116  wid2.calib = *calib;
117  wid2.calper = *calper;
118  wid2.hang = *hang;
119  wid2.vang = *vang;
120  fapidxx::WID2container wid2c(wid2);
121  wid2c.encode(wid2line, wid2line_len);
122  *ierr=0;
123  return(0);
124 } // int sff_prepwid2__
125 
126 /* ----- END OF fapid_sff_prepwid2.cc ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
long int integer
Fortran integer type.
Definition: fapidsff.h:66
This struct is used to pass WID2 line data within libfapidxx.
Definition: wid2container.h:62
container for WID2 data (prototypes)
exceptions and error handling macros (prototypes)
float real
Fortran real type (single precision)
Definition: fapidsff.h:73
int sff_prepwid2__(integer *nsamp, real *samprat, char *station, integer *year, integer *month, integer *day, integer *hour, integer *minute, char *comp, char *auxid, char *instyp, real *second, real *calib, real *calper, real *hang, real *vang, char *wid2line, integer *ierr, ftnlen station_len, ftnlen comp_len, ftnlen auxid_len, ftnlen instyp_len, ftnlen wid2line_len)
Encode WID2 data.
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
void encode(char *fstring, ftnlen slen) const
encode data into a character string depending on wasascii flag
some helper functions (prototypes)