DATRW++ library: seismic data I/O with multiple formats

◆ set()

void datrw::seife::ParameterLine::set ( const std::string &  line)

set values from line

Definition at line 56 of file seifeio.cc.

References DATRW_assert, DATRW_debug, DATRW_value, line(), Mdebug, Mdt, Mformat, Mnsamples, Mtime, and nsamples().

Referenced by datrw::seife::Header::read().

57  {
58  DATRW_debug(Mdebug, "ParameterLine::set",
59  "read values from line:\n" << line);
60  std::istringstream iss(line.substr(0,10));
61  DATRW_assert(iss.good(), "ERROR: iss is not good");
62  DATRW_debug(Mdebug, "ParameterLine::set",
63  DATRW_value(line.substr(0,10)));
64  int nsamples;
65  iss >> nsamples;
66  DATRW_assert(nsamples>0, "ERROR: number of samples is not positive");
67  Mnsamples=static_cast<unsigned int>(nsamples);
68  DATRW_debug(Mdebug, "ParameterLine::set",
70  //DATRW_assert(iss.good(), "ERROR: reading number of samples");
71  iss.clear();
72  iss.str(line.substr(10,20));
73  DATRW_debug(Mdebug, "ParameterLine::set",
74  DATRW_value(iss.str()));
75  iss >> Mformat;
76  DATRW_debug(Mdebug, "ParameterLine::set",
77  DATRW_value(line.substr(10,20)) << "\n"
79  //DATRW_assert(iss.good(), "ERROR: reading Fortran data format");
80  iss.clear();
81  iss.str(line.substr(30,10));
82  DATRW_debug(Mdebug, "ParameterLine::set",
83  DATRW_value(iss.str()));
84  iss >> Mdt;
85  DATRW_assert(Mdt>0., "ERROR: sampling interval is not positive");
86  DATRW_debug(Mdebug, "ParameterLine::set",
87  DATRW_value(line.substr(30,10)) << "\n"
88  DATRW_value(Mdt));
89  //DATRW_assert(iss.good(), "ERROR: reading sampling interval");
90  double tmin, tsec;
91  iss.clear();
92  iss.str(line.substr(40,10));
93  iss >> tmin;
94  DATRW_debug(Mdebug, "ParameterLine::set",
95  DATRW_value(line.substr(40,10)) << "\n"
96  DATRW_value(tmin));
97  //DATRW_assert(iss.good(), "ERROR: reading number of minutes");
98  iss.clear();
99  iss.str(line.substr(50,10));
100  iss >> tsec;
101  DATRW_debug(Mdebug, "ParameterLine::set",
102  DATRW_value(line.substr(50,10)) << "\n"
103  DATRW_value(tsec));
104  //DATRW_assert(iss.good(), "ERROR: reading number of seconds");
105  Mtime=libtime::double2time(tsec)+libtime::double2time(tmin*60.);
106  DATRW_debug(Mdebug, "ParameterLine::set",
107  DATRW_value(Mtime.timestring()));
108  } // void ParameterLine::set(const std::string& line)
unsigned int Mnsamples
number of samples
Definition: seifeio.h:117
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
unsigned int nsamples() const
return number of samples
Definition: seifeio.h:92
bool Mdebug
request debug output
Definition: seifeio.h:115
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
std::string Mformat
Fortran data format.
Definition: seifeio.h:119
double Mdt
sampling interval
Definition: seifeio.h:121
libtime::TRelativeTime Mtime
time of first sample
Definition: seifeio.h:123
#define DATRW_value(V)
report value
Definition: debug.h:65
std::string line() const
create line for output from values
Definition: seifeio.cc:112
Here is the call graph for this function:
Here is the caller graph for this function: