Commit 0b7a6784 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libtsxx [WP][DOC]: move member documentation from declaration to definition

parent 5828a100
......@@ -69,43 +69,31 @@ namespace ts {
typedef std::vector<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
*/
//! Check consistency
bool are_consistent(const ::sff::WID2compare comparer) const;
/*! \brief Check is 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.
*
* \return true, if time series overlap
*/
//! Check whether all time series have a common time window
bool overlap() const;
/*! \brief Trim to same start time
*
* 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 trim_to_date(const ::sff::WID2compare comparer) const;
//! Synchronize header with series
void synchronize_nsamples();
//! Trim to same start time
void trim_to_date();
//! Trim to same number of samples
void trim_to_nsamples();
}; // class TimeSeriesCollection
/* ---------------------------------------------------------------------- */
/*! \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
*/
template<typename T>
bool TimeSeriesCollection<T>::are_consistent(const ::sff::WID2compare comparer) const
{
......@@ -126,6 +114,13 @@ namespace ts {
/* ---------------------------------------------------------------------- */
/*! \brief 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.
*
* \return true, if time series overlap
*/
template<typename T>
bool TimeSeriesCollection<T>::overlap() const
{
......@@ -154,6 +149,86 @@ namespace ts {
return(retval);
} // bool TimeSeriesCollection<T>::overlap() const
/* ---------------------------------------------------------------------- */
/*! \brief Synchronize header with series
*
* Set actual number of samples and nsamples in header to the smaller of
* both.
*/
template<typename T>
void TimeSeriesCollection<T>::synchronize_nsamples()
{
typename Tbase::const_iterator i_series=this->begin();
while (i_series != this->end())
{
const unsigned int& header_nsamples=i_series->header.nsamples;
unsigned int series_nsamples=i_series->data.size();
unsigned int nsamples=
series_nsamples < header_nsamples
? series_nsamples : header_nsamples;
i_series->header.nsamples=nsamples;
i_series->data.setlastindex(i_series->data.f()+nsamples-1);
++i_series;
}
} // void TimeSeriesCollection<T>::synchronize_nsamples()
/* ---------------------------------------------------------------------- */
/*! \brief Trim to same start time
*
* Set all start dates to the latest found in the collection.
*/
template<typename T>
void TimeSeriesCollection<T>::trim_to_date()
{
if (this->size() > 1)
{
typename Tbase::const_iterator i_series=this->begin();
// find lastest start date
Theader header=i_series->header;
libtime::TAbsoluteTime begin=header.date;
++i_series;
while (i_series != this->end())
{
header=i_series->header;
libtime::TAbsoluteTime thisbegin=header.date;
begin = thisbegin > begin ? thisbegin : begin;
++i_series;
}
}
} // void TimeSeriesCollection<T>::trim_to_date()
/* ---------------------------------------------------------------------- */
/*! \brief Trim to same number of samples
*
* Set length of all time series to smallest found in collection.
*/
template<typename T>
void TimeSeriesCollection<T>::trim_to_nsamples()
{
this->synchronize_nsamples();
if (this->size() > 1)
{
// find smallest number of samples in collection
typename Tbase::const_iterator i_series=this->begin();
Theader header=i_series->header;
unsigned int nsamples=header.nsamples;
++i_series;
while (i_series != this->end())
{
header=i_series->header;
unsigned int thisnsamples=header.nsamples;
end = thisnsamples < nsamples ? thisnsamples : nsamples;
++i_series;
}
}
} // void TimeSeriesCollection<T>::trim_to_nsamples()
/* ---------------------------------------------------------------------- */
} // 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