37 #ifndef TS_TSCOLLECTION_H_VERSION 39 #define TS_TSCOLLECTION_H_VERSION \ 40 "TS_TSCOLLECTION_H V1.0" 57 public std::vector<TimeSeries<aff::Series<T>, ::sff::WID2> >
70 typedef std::vector<Ttimeseries>
Tbase;
102 if (this->size() > 1)
104 typename Tbase::const_iterator i_series=this->begin();
105 Theader refheader=i_series->header;
107 while ((i_series != this->end()) && retval)
109 retval=comparer(refheader, i_series->header);
129 if (this->size() > 1)
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);
136 while ((i_series != this->end()) && retval)
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;
145 retval=(end >= begin);
160 typename Tbase::iterator i_series=this->begin();
161 while (i_series != this->end())
163 const unsigned int& header_nsamples=i_series->header.nsamples;
164 unsigned int series_nsamples=i_series->size();
165 unsigned int nsamples=
166 series_nsamples < header_nsamples
167 ? series_nsamples : header_nsamples;
168 i_series->header.nsamples=nsamples;
169 i_series->setlastindex(i_series->f()+nsamples-1);
183 if (this->size() > 1)
186 typename Tbase::iterator i_series=this->begin();
187 Theader header=i_series->header;
188 libtime::TAbsoluteTime begin=header.date;
190 while (i_series != this->end())
192 header=i_series->header;
193 libtime::TAbsoluteTime thisbegin=header.date;
194 begin = thisbegin > begin ? thisbegin : begin;
199 i_series=this->begin();
200 while (i_series != this->end())
202 header=i_series->header;
203 long int index_offset=wid2isample(header, begin);
205 "inconsistent header data");
207 "time series does not overlap with others");
208 i_series->header.date=wid2isample(header, index_offset);
209 i_series->header.nsamples -= index_offset;
210 i_series->setfirstindex(i_series->f()+index_offset);
225 this->synchronize_nsamples();
226 if (this->size() > 1)
229 typename Tbase::iterator i_series=this->begin();
230 Theader header=i_series->header;
231 unsigned int nsamples=header.nsamples;
233 while (i_series != this->end())
235 header=i_series->header;
236 unsigned int thisnsamples=header.nsamples;
237 nsamples = thisnsamples < nsamples ? thisnsamples : nsamples;
242 i_series=this->begin();
243 while (i_series != this->end())
245 i_series->header.nsamples = nsamples;
246 i_series->setlastindex(i_series->f()+nsamples-1);
256 #endif // TS_TSCOLLECTION_H_VERSION (includeguard) bool overlap() const
Check whether all time series have a common time window.
bool are_consistent(const ::sff::WID2compare comparer) const
Check consistency.
ts::TimeSeries< typename Tseries::Tcoc, Theader > Tconsttimeseries
error handling for libtsxx (prototypes)
A class template for a list of time series with SFF header.
Structure to hold the data samples of a series together with header information to form a time series...
std::vector< Ttimeseries > Tbase
All stuff in this library will be placed within namespace ts.
ts::TimeSeries< Tseries, Theader > Ttimeseries
aff::Series< Tvalue > Tseries
#define TSXX_assert(C, M)
Check an assertion and report by throwing an exception.
time series with WID2 header (prototypes)
void synchronize_nsamples()
Synchronize header with series.
void trim_to_nsamples()
Trim to same number of samples.
void trim_to_date()
Trim to same start time.