Fortran SFF API to data I/O streams in C++
wid2container.h
Go to the documentation of this file.
1 
35 // include guard
36 #ifndef TF_WID2CONTAINER_H_VERSION
37 
38 #define TF_WID2CONTAINER_H_VERSION \
39  "TF_WID2CONTAINER_H V1.0 "
40 
41 #include<libtime++.h>
42 #include<sffxx.h>
43 
44 namespace fapidxx {
45 
62  struct WID2container {
63 
106  struct WID2struct {
107  // static constants
108  static const char* encodeID;
109  static const unsigned short idlen=4;
110  static const unsigned short slen=5;
111  static const unsigned short clen=3;
112  static const unsigned short alen=4;
113  static const unsigned short ilen=6;
114  // data fields
115  char ID[idlen];
116  libtime::timeint year;
117  libtime::timeint month;
118  libtime::timeint day;
119  libtime::timeint hour;
120  libtime::timeint minute;
121  libtime::timeint second;
122  libtime::timeint milsec;
123  libtime::timeint micsec;
124  char station[slen+1];
125  char channel[clen+1];
126  char auxid[alen+1];
127  int nsamples;
128  double dt;
129  double calib;
130  double calper;
131  char instype[ilen+1];
132  double hang;
133  double vang;
134  // member functions
136  void set(const ::sff::WID2& wid2);
138  ::sff::WID2 get() const;
139  }; // struct WID2struct
141  WID2container(const std::string& line)
142  { setwid2(line); wasascii=true; }
144  WID2container(char *fstring, ftnlen slen)
145  { setwid2(fstring, slen); }
147  WID2container(const ::sff::WID2& iwid2):
148  wid2(iwid2), wasascii(false) { }
150  void setwid2(const std::string& line);
152  void setwid2(char *fstring, ftnlen slen);
154  void encodebinary(char *fstring, ftnlen slen) const;
156  void encodeascii(char *fstring, ftnlen slen) const;
158  void encode(char *fstring, ftnlen slen) const;
160  sff::WID2 wid2;
162  bool wasascii;
163  }; // struct WID2container {
164 
165 } // namespace fapidxx
166 
167 #endif // TF_WID2CONTAINER_H_VERSION (includeguard)
168 
169 /* ----- END OF wid2container.h ----- */
void encodeascii(char *fstring, ftnlen slen) const
encode data into a standard SFF character string
static const unsigned short ilen
char channel[clen+1]
FDSN channel code.
Definition: error.cc:44
char instype[ilen+1]
instrument type
double dt
sampling interval (sec)
double calib
calibration factor
libtime::timeint micsec
time of first sample (microsecond)
void setwid2(const std::string &line)
fill data fields from a conventional WID2 line
sff::WID2 wid2
WID2 data.
libtime::timeint month
date of first sample (month value)
This struct is used to pass WID2 line data within libfapidxx.
Definition: wid2container.h:62
libtime::timeint day
date of first sample (day value)
double vang
veritcal orientation
static const char * encodeID
ID indicating the WID2 is encoded in binary form in the WID2 line.
libtime::timeint year
date of first sample (year value)
WID2container(const std::string &line)
construct from C++ string
void encodebinary(char *fstring, ftnlen slen) const
encode data into a binary character string
WID2container(const ::sff::WID2 &iwid2)
construct from an SFF WID2 container
static const unsigned short slen
bool wasascii
true, if original data was ASCII encoded
char auxid[alen+1]
Auxiliary identification code.
int nsamples
number of samples
static const unsigned short clen
static const unsigned short alen
libtime::timeint hour
time of first sample (hour)
libtime::timeint minute
time of first sample (minute)
long int ftnlen
Fortran string size type.
Definition: fapidsff.h:70
double calper
calibration reference period
double hang
horizontal orientation
WID2container(char *fstring, ftnlen slen)
construct from Fortran character sequence
char station[slen+1]
Station code.
void encode(char *fstring, ftnlen slen) const
encode data into a character string depending on wasascii flag
This struct ist used by fapidxx::WID2container to store WID2 line data.
libtime::timeint milsec
time of first sample (millisecond)
libtime::timeint second
time of first sample (second)
static const unsigned short idlen