Commit ac710862 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

Merge branch 'tscollect' into croposp

parents 0c2c80b8 d7b83611
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"TS_TSCOLLECTION_H V1.0" "TS_TSCOLLECTION_H V1.0"
#include<vector> #include<vector>
#include<tsxx/error.h>
#include<tsxx/wid2timeseries.h> #include<tsxx/wid2timeseries.h>
namespace ts { namespace ts {
...@@ -130,13 +131,13 @@ namespace ts { ...@@ -130,13 +131,13 @@ namespace ts {
typename Tbase::const_iterator i_series=this->begin(); typename Tbase::const_iterator i_series=this->begin();
Theader header=i_series->header; Theader header=i_series->header;
libtime::TAbsoluteTime begin=header.date; libtime::TAbsoluteTime begin=header.date;
libtime::TAbsoluteTime end=sff::wid2lastsample(header); libtime::TAbsoluteTime end=::sff::wid2lastsample(header);
++i_series; ++i_series;
while ((i_series != this->end()) && retval) while ((i_series != this->end()) && retval)
{ {
header=i_series->header; header=i_series->header;
libtime::TAbsoluteTime thisbegin=header.date; libtime::TAbsoluteTime thisbegin=header.date;
libtime::TAbsoluteTime thisend=sff::wid2lastsample(header); libtime::TAbsoluteTime thisend=::sff::wid2lastsample(header);
begin = thisbegin > begin ? thisbegin : begin; begin = thisbegin > begin ? thisbegin : begin;
end = thisend < end ? thisend : end; end = thisend < end ? thisend : end;
++i_series; ++i_series;
...@@ -156,16 +157,16 @@ namespace ts { ...@@ -156,16 +157,16 @@ namespace ts {
template<typename T> template<typename T>
void TimeSeriesCollection<T>::synchronize_nsamples() void TimeSeriesCollection<T>::synchronize_nsamples()
{ {
typename Tbase::const_iterator i_series=this->begin(); typename Tbase::iterator i_series=this->begin();
while (i_series != this->end()) while (i_series != this->end())
{ {
const unsigned int& header_nsamples=i_series->header.nsamples; const unsigned int& header_nsamples=i_series->header.nsamples;
unsigned int series_nsamples=i_series->data.size(); unsigned int series_nsamples=i_series->size();
unsigned int nsamples= unsigned int nsamples=
series_nsamples < header_nsamples series_nsamples < header_nsamples
? series_nsamples : header_nsamples; ? series_nsamples : header_nsamples;
i_series->header.nsamples=nsamples; i_series->header.nsamples=nsamples;
i_series->data.setlastindex(i_series->data.f()+nsamples-1); i_series->setlastindex(i_series->f()+nsamples-1);
++i_series; ++i_series;
} }
} // void TimeSeriesCollection<T>::synchronize_nsamples() } // void TimeSeriesCollection<T>::synchronize_nsamples()
...@@ -206,7 +207,7 @@ namespace ts { ...@@ -206,7 +207,7 @@ namespace ts {
"time series does not overlap with others"); "time series does not overlap with others");
i_series->header.date=begin; i_series->header.date=begin;
i_series->header.nsamples -= index_offset; i_series->header.nsamples -= index_offset;
i_series->data.setfirstindex(i_series.data.f()+index_offset); i_series->setfirstindex(i_series->f()+index_offset);
++i_series; ++i_series;
} }
} }
...@@ -233,7 +234,7 @@ namespace ts { ...@@ -233,7 +234,7 @@ namespace ts {
{ {
header=i_series->header; header=i_series->header;
unsigned int thisnsamples=header.nsamples; unsigned int thisnsamples=header.nsamples;
end = thisnsamples < nsamples ? thisnsamples : nsamples; nsamples = thisnsamples < nsamples ? thisnsamples : nsamples;
++i_series; ++i_series;
} }
...@@ -242,7 +243,7 @@ namespace ts { ...@@ -242,7 +243,7 @@ namespace ts {
while (i_series != this->end()) while (i_series != this->end())
{ {
i_series->header.nsamples = nsamples; i_series->header.nsamples = nsamples;
i_series->data.setlastindex(i_series.data.f()+nsamples-1); i_series->setlastindex(i_series->f()+nsamples-1);
++i_series; ++i_series;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment