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

◆ value()

int datrw::mseed::SEED::Steim2Word::value ( const int &  i) const

return value

  • i index in word

Definition at line 317 of file seedstructs.cc.

References DATRW_abort, DATRW_assert, dnib(), extract(), Fbyte, Fdnib00, Fdnib01, Fdnib1, Fdnib10, Fdnib11, Fdnib2, Fspecial, Mctrl, Mword, and nval().

Referenced by datrw::mseed::SEED::Steim2Frame::diff(), datrw::mseed::SEED::dump(), and extract().

318  {
319  int nval=this->nval();
320  DATRW_assert((i<nval),
321  "ERROR (Steim2Word::value): "
322  "illegal value index");
323  int retval=0;
324  --nval;
325  switch (Mctrl) {
327  retval=Mword;
328  break;
329  case Steim2Word::Fbyte:
330  // bytes must be read in a different order
331  // since we do not swap this word
332  // which is consistent with decode_steim2.c in rdseed
333  retval=this->extract(8,i);
334  break;
335  case Steim2Word::Fdnib1:
336  switch (this->dnib()) {
337  case Steim2Word::Fdnib01:
338  retval=this->extract(30,0);
339  break;
340  case Steim2Word::Fdnib10:
341  retval=this->extract(15,nval-i);
342  break;
343  case Steim2Word::Fdnib11:
344  retval=this->extract(10,nval-i);
345  break;
346  default:
347  DATRW_abort("ERROR (Steim2Word::value): "
348  "illegal decode nibble");
349  }
350  break;
351  case Steim2Word::Fdnib2:
352  switch (this->dnib()) {
353  case Steim2Word::Fdnib00:
354  retval=this->extract(6,nval-i);
355  break;
356  case Steim2Word::Fdnib01:
357  retval=this->extract(5,nval-i);
358  break;
359  case Steim2Word::Fdnib10:
360  retval=this->extract(4,nval-i);
361  break;
362  default:
363  DATRW_abort("ERROR (Steim2Word::value): "
364  "illegal decode nibble");
365  }
366  break;
367  default:
368  DATRW_abort("ERROR (Steim2Word::value): illegal ctrl code");
369  }
370  return(retval);
371  } // int Steim2Word::value(const int& p) const
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
int nval() const
return number of values in this word
Definition: seedstructs.cc:267
int dnib() const
return dnib
Definition: seedstructs.cc:260
four 8-bit differences (byte)
Definition: seedstructs.h:419
#define DATRW_abort(M)
Abort and give a message.
Definition: error.h:101
int extract(const int &b, const int &p) const
Definition: seedstructs.cc:375
contains non-data information, like headers
Definition: seedstructs.h:418
Here is the call graph for this function:
Here is the caller graph for this function: