next up previous contents
Next: Subsetting Data Series Up: Some Functions and Methods Previous: General Methods   Contents

Time Series Handling

$\bullet$
QdTimeSeq_var get_timetags(QdObject_var& obj) returns a _var pointer to the TIME_TAGS xref for the object, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
  QdTimeSeq_var tags = get_timetags(ts1);
  if (!tags.is_nil()) { 
    ...     
  }
The returned pointer is always to an object of type QdTimeSeq_var.(A)

$\bullet$
bool is_timeseries(QdObject_var& obj) returns true if the object has a
TIME_TAGS xref, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   if(is_timeseries(obj)){
     QdTimeSeq_var tags = get_timetags(obj);
      ...     
   }
This is equivalent to obj->xref_exists(TIME_TAGS).(A)

$\bullet$
bool is_timetags(QdObject_var& obj) returns true if the object is itself a sequence of time values, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   if(is_timetags(obj)){
      ...     
   }
This is equivalent to a narrow to QdTimeSeq_var and test !tt.is_nil(). Note that a QdTimeSeq_var is a sequence of QdTime objects (time tags), whereas a time sequence is a sequence of data objects with a TIME_TAGS xref to a QdTimeSeq_var object containing the time tags.(A)

$\bullet$
bool is_timeinterval(QdObject_var& obj) returns true if the object is of type QdTimeInterval_var, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   if(is_timeinterval(obj)){
      ...     
   }
This is equivalent to a narrow to QdTimeInterval_var and test !ti.is_nil(). Note that get_timeinterval below will return the interval associated with a time sequence and allows a more general interface.(A)

$\bullet$
bool QuIsTSRegular(QdTimeSeq_var tt, double *spacing)
returns true if the time tags, tt, are evenly spaced, and without gaps, e.g.
  #include "qplug_if.h"
  #include "QdUtils.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   double * spacing;
   QdTimeSeq_var tt = get_timetags(obj);
   if( QuIsTSRegular(tt, spacing) ){
      period_in_msec = spacing * 1000;
      ...     
   }
The pointer spacing, returns the value of the interval between consecutive time tags in seconds.(U)

$\bullet$
void set_timetags(QdObject_var obj, QdTimeSeq_var ts)
sets the TIME_TAGS xref for an object to point to the time tags, tt, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   QdTimeSeq_var tt = get_timetags(InObj);
   if( !tt.is_nil() )
      set_timetags(OutObj, tt);
Note this does not make a copy of the time tags object, and both the input and output data series will share the same time tags. The convention within QSAS is to make a copy of a set of time tags if the QdTimeSeq itself is to be changed in any way, otherwise derived objects share time tags to simplify joining and ensure arithmetic is valid. Objects that share time tags are `joined' onto the same time line. Several objects on the working list may share a common set of time tags.(A)

$\bullet$
QdTimeInterval_var get_timeinterval(QdObject_var& obj), returns a _var pointer to a QdTimeInterval object containing the start and end time-tag values for the object, e.g.
  #include "qplug_if.h"
  #include "QsasUtils.h"
  #include "Qdos.h"
  using namespace QSAS;
   QdObject_var input1 = (* object_list)[1]; 
   QdTimeInterval_var ti = get_timeinterval(input1);
Use of time interval objects is described below.(A)


next up previous contents
Next: Subsetting Data Series Up: Some Functions and Methods Previous: General Methods   Contents
Anthony Allen 2005-11-07