TS++ library: time series library

◆ read()

void ts::tapers::ovtaper::Picks::read ( std::istream &  is)

read from file in refract taper file format

Definition at line 54 of file ovtaper.cc.

References Mdebug, Mpicks, ts::tapers::ovtaper::Pick::t, TSXX_assert, TSXX_debug, and ts::tapers::ovtaper::Pick::x.

Referenced by ts::tapers::OffsetVariableTaper::read().

55  {
56  Mpicks.clear();
57  std::string line;
58  do {
59  TSXX_assert(getline(is, line),
60  "Picks::read: error while reading taper definition");
61  } while (line.substr(0,9)!="taper set");
62 
63  TSXX_debug(Mdebug, "Picks::read",
64  "found data line:\n" << line);
65 
66  std::istringstream iss(line.substr(17,4));
67  int n;
68  iss >> n;
69  TSXX_debug(Mdebug, "Picks::read",
70  "read " << n << " picks");
71 
72  // skip one line
73  TSXX_assert(getline(is, line),
74  "Picks::read: error while reading taper definition");
75  for (int i=0; i<n; ++i)
76  {
77  Pick p;
78  TSXX_assert(is >> p.x >> p.t,
79  "Picks::read: error while reading taper definition");
80  Mpicks.push_back(p);
81  TSXX_debug(Mdebug, "Picks::read",
82  "#" << i << " x=" << p.x << ", t=" << p.t);
83  }
84 
85  Mpicks.sort();
86  } // void Picks::read(std::istream& is)
bool Mdebug
produce debug output if true
Definition: ovtaper.h:86
Tlistofpick Mpicks
picks
Definition: ovtaper.h:88
#define TSXX_debug(C, N, M)
produce debug output
Definition: debug.h:51
#define TSXX_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:127
Here is the caller graph for this function: