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

Merge branch 'tscollect' into croposp

parents 91e80cf6 38eba2d7
......@@ -39,21 +39,26 @@
#define TS_TSCOLLECTION_H_VERSION \
"TS_TSCOLLECTION_H V1.0"
#include<list>
#include<vector>
#include<tsxx/wid2timeseries.h>
namespace ts {
/*! \brief A class template for a list of time series with SFF header.
*
* A TimeSeriesCollection is a vector of ts::TimeSeries with some additional
* member functions.
*
* \param T value type of series container
*/
template<typename T>
class TimeSeriesCollection:
public std::list<TimeSeries<aff::Series<T>, ::sff::WID2> >
public std::vector<TimeSeries<aff::Series<T>, ::sff::WID2> >
{
public:
/*! \name Type definitions.
*
* Provided to define proper base types of class template
*/
//!@{
typedef T Tvalue;
......@@ -64,16 +69,39 @@ namespace ts {
typedef std::list<Ttimeseries> Tbase;
//!@}
/*! \name Constructors.
/*! \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.
*
* Conversion constructors are declared explicit, to avoid confusion,
* in mutual assignments of different class derived from this
* template. They all are a valid Tseries by definition.
* \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)
......
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