All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::st::TimeSeriesIterator Class Reference

A class to traverse the observations of a TimeSeries. More...

#include <TimeSeriesIterator.h>

Public Member Functions

double getDouble () const
 It returns the attribute value as a double pointed by the internal cursor. More...
 
int getInt () const
 It returns the attribute value as an integer pointed by the internal cursor. More...
 
std::string getString () const
 It returns the attribute value as a string pointed by the internal cursor. More...
 
te::dt::DateTimegetTime () const
 It returns the datetime pointed by the internal cursor. More...
 
te::dt::AbstractDatagetValue () const
 It returns the attribute value pointed by the internal cursor. More...
 
bool operator!= (const TimeSeriesIterator &rhs)
 Operator !=. More...
 
TimeSeriesObservation operator* () const
 Prefix operator *. More...
 
TimeSeriesIteratoroperator++ ()
 Prefix operator ++. More...
 
TimeSeriesIterator operator++ (int aux)
 Postfix operator ++. More...
 
TimeSeriesIteratoroperator-- ()
 Prefix operator –. More...
 
TimeSeriesIterator operator-- (int aux)
 Postfix operator –. More...
 
const TimeSeriesIteratoroperator= (const TimeSeriesIterator &rhs)
 Assignment operator. More...
 
bool operator== (const TimeSeriesIterator &rhs)
 Operator ==. More...
 
 TimeSeriesIterator ()
 Empty constructor. More...
 
 TimeSeriesIterator (TimeSeriesObservationSet::const_iterator &it)
 Constructor. More...
 
virtual ~TimeSeriesIterator ()
 Virtual destructor. More...
 

Private Attributes

TimeSeriesObservationSet::const_iterator m_it
 The internal cursor. More...
 

Detailed Description

A class to traverse the observations of a TimeSeries.

This class provides a mechanism to traverse the time series observations sequentially, ordered by time.

An example of use:

TimeSeriesIterator it = tj.begin(); while(it!=tj.end()) { DateTime* t = it.getTime(); double v = it.getDouble(); //or getValue() or getInt or... ++it; }

See also
TimeSeries

Definition at line 68 of file TimeSeriesIterator.h.

Constructor & Destructor Documentation

te::st::TimeSeriesIterator::TimeSeriesIterator ( )

Empty constructor.

Definition at line 33 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator::TimeSeriesIterator ( TimeSeriesObservationSet::const_iterator &  it)

Constructor.

Parameters
itA iterator that points to the TimeSeries observations

Definition at line 37 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator::~TimeSeriesIterator ( )
virtual

Virtual destructor.

Definition at line 118 of file TimeSeriesIterator.cpp.

Member Function Documentation

double te::st::TimeSeriesIterator::getDouble ( ) const

It returns the attribute value as a double pointed by the internal cursor.

Returns
A pointer to the attribute value as a double pointed by the internal cursor.

Definition at line 103 of file TimeSeriesIterator.cpp.

int te::st::TimeSeriesIterator::getInt ( ) const

It returns the attribute value as an integer pointed by the internal cursor.

Returns
A pointer to the attribute value as an integer pointed by the internal cursor.

Definition at line 108 of file TimeSeriesIterator.cpp.

std::string te::st::TimeSeriesIterator::getString ( ) const

It returns the attribute value as a string pointed by the internal cursor.

Returns
A pointer to the attribute value as a string pointed by the internal cursor.

Definition at line 113 of file TimeSeriesIterator.cpp.

te::dt::DateTime * te::st::TimeSeriesIterator::getTime ( ) const

It returns the datetime pointed by the internal cursor.

Returns
A pointer to the datetime pointed by the internal cursor.
Note
The caller will NOT take the ownership of the returned pointer.

Definition at line 93 of file TimeSeriesIterator.cpp.

Referenced by te::st::TimeSeries::getPatches().

te::dt::AbstractData * te::st::TimeSeriesIterator::getValue ( ) const

It returns the attribute value pointed by the internal cursor.

Returns
A pointer to the attribute value pointed by the internal cursor.
Note
The caller will NOT take the ownership of the returned pointer.

Definition at line 98 of file TimeSeriesIterator.cpp.

bool te::st::TimeSeriesIterator::operator!= ( const TimeSeriesIterator rhs)

Operator !=.

Definition at line 57 of file TimeSeriesIterator.cpp.

References m_it.

te::st::TimeSeriesObservation te::st::TimeSeriesIterator::operator* ( ) const

Prefix operator *.

It returns the observation (a pair of shared pointers to the time and value) pointed by the internal cursor.

Definition at line 88 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator & te::st::TimeSeriesIterator::operator++ ( )

Prefix operator ++.

After using this operator, the internal cursor points to the next TimeSeries observation.

The semantics of prefix is this: Increment the value and then fetch it.

Definition at line 62 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator te::st::TimeSeriesIterator::operator++ ( int  aux)

Postfix operator ++.

After using this operator, the internal cursor points to the next TimeSeries observation.

The semantics of postfix is: Fetch the value and then increment the original.

Definition at line 68 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator & te::st::TimeSeriesIterator::operator-- ( )

Prefix operator –.

After using this operator, the internal cursor points to the preceding TimeSeries observation.

The semantics of prefix is this: Increment the value and then fetch it.

Definition at line 75 of file TimeSeriesIterator.cpp.

te::st::TimeSeriesIterator te::st::TimeSeriesIterator::operator-- ( int  aux)

Postfix operator –.

After using this operator, the internal cursor points to the preceding TimeSeries observation.

The semantics of postfix is: Fetch the value and then increment the original.

Definition at line 81 of file TimeSeriesIterator.cpp.

const te::st::TimeSeriesIterator & te::st::TimeSeriesIterator::operator= ( const TimeSeriesIterator rhs)

Assignment operator.

Definition at line 43 of file TimeSeriesIterator.cpp.

References m_it.

bool te::st::TimeSeriesIterator::operator== ( const TimeSeriesIterator rhs)

Operator ==.

Definition at line 52 of file TimeSeriesIterator.cpp.

References m_it.

Member Data Documentation

TimeSeriesObservationSet::const_iterator te::st::TimeSeriesIterator::m_it
private

The internal cursor.

Definition at line 184 of file TimeSeriesIterator.h.

Referenced by operator!=(), operator=(), and operator==().


The documentation for this class was generated from the following files: