Commit 38eba2d7 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libtsxx [WP][FEATURE]: add TimeSeriesCollection::are_consistent

parent 7e9efec9
......@@ -68,9 +68,40 @@ namespace ts {
typedef ts::TimeSeries<typename Tseries::Tcoc, Theader> Tconsttimeseries;
typedef std::list<Ttimeseries> Tbase;
//!@}
/*! \brief Check consistency
*
* Check the consistency of the time series in the collections based on
* header data. For example this can be used to check whether all time
* series have the same number of samples.
*
* \param comparer defines the header fields to be compared
* \return true, if comparer returns true for comparison of all pairs
* of time series headers in the collection
*/
bool are_consistent(const ::sff::WID2compare comparer) const;
}; // class TimeSeriesCollection
/* ---------------------------------------------------------------------- */
template<typename T>
bool TimeSeriesCollection<T>::are_consistent(const ::sff::WID2compare comparer) const
{
bool retval=true;
if (this->size() > 1)
{
Tbase::const_iterator i_series=this->begin();
Theader refheader=i_series->header;
++i_series;
while ((i_series != this->end()) && retval)
{
retval=comparer(refheader; i_series->header);
}
}
return(retval);
} // bool TimeSeriesCollection<T>::are_consistent(const ::sff::WID2compare comparer) const
} // namespace ts
#endif // TS_TSCOLLECTION_H_VERSION (includeguard)
......
Markdown is supported
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