TS++ library: time series library

◆ overlap()

template<typename T >
bool ts::TimeSeriesCollection< T >::overlap ( ) const

Check whether all time series have a common time window.

Check whether all time series overlap in time. This is a necessary prerequisite for trimming all time series to a common time window.

Returns
true, if time series overlap

Definition at line 126 of file tscollection.h.

127  {
128  bool retval=true;
129  if (this->size() > 1)
130  {
131  typename Tbase::const_iterator i_series=this->begin();
132  Theader header=i_series->header;
133  libtime::TAbsoluteTime begin=header.date;
134  libtime::TAbsoluteTime end=::sff::wid2lastsample(header);
135  ++i_series;
136  while ((i_series != this->end()) && retval)
137  {
138  header=i_series->header;
139  libtime::TAbsoluteTime thisbegin=header.date;
140  libtime::TAbsoluteTime thisend=::sff::wid2lastsample(header);
141  begin = thisbegin > begin ? thisbegin : begin;
142  end = thisend < end ? thisend : end;
143  ++i_series;
144  }
145  retval=(end >= begin);
146  }
147  return(retval);
148  } // bool TimeSeriesCollection<T>::overlap() const