TECA
The Toolkit for Extreme Climate Analysis
teca_calendar_util::interval_iterator Class Referenceabstract

An iterator over a series of time intervals. More...

#include <teca_calendar_util.h>

Inheritance diagram for teca_calendar_util::interval_iterator:
Collaboration diagram for teca_calendar_util::interval_iterator:

Public Member Functions

virtual int initialize (const teca_metadata &md)
 
virtual int initialize (const teca_metadata &md, long first_step, long last_step)
 
virtual int initialize (const const_p_teca_variant_array &t, const std::string &units, const std::string &calendar, long first_step, long last_step)=0
 
virtual bool is_valid () const =0
 return true if there are more time steps in the sequence More...
 
virtual int get_next_interval (time_point &first_step, time_point &last_step)=0
 
 operator bool () const
 
const time_pointget_begin () const
 return the first time point in the series More...
 
const time_pointget_end () const
 return the last time point in the series More...
 

Protected Attributes

const_p_teca_variant_array time
 
std::string units
 
std::string calendar
 
time_point begin
 
time_point end
 
bool valid
 

Detailed Description

An iterator over a series of time intervals.

Member Function Documentation

◆ get_begin()

const time_point& teca_calendar_util::interval_iterator::get_begin ( ) const
inline

return the first time point in the series

◆ get_end()

const time_point& teca_calendar_util::interval_iterator::get_end ( ) const
inline

return the last time point in the series

◆ get_next_interval()

virtual int teca_calendar_util::interval_iterator::get_next_interval ( time_point first_step,
time_point last_step 
)
pure virtual

Get the next interval in the series.

Parameters
[out]first_stepThe first step in the next element of the series
[out]last_stepThe last step in the next element of the series
Returns
0 if successfully initialized

Implemented in teca_calendar_util::day_iterator, teca_calendar_util::month_iterator, teca_calendar_util::year_iterator, and teca_calendar_util::season_iterator.

◆ initialize() [1/3]

virtual int teca_calendar_util::interval_iterator::initialize ( const const_p_teca_variant_array t,
const std::string &  units,
const std::string &  calendar,
long  first_step,
long  last_step 
)
pure virtual

Initialize the iterator.

Parameters
[in]tAn array of time values
[in]unitsA string units of the time values
[in]calendarA string name of the calendar system
[in]first_stepthe first step to include in the series or 0 to use all
[in]last_stepthe last step to include in the series or -1 to use all
Returns
0 if successfully initialized

Implemented in teca_calendar_util::day_iterator, teca_calendar_util::month_iterator, teca_calendar_util::year_iterator, and teca_calendar_util::season_iterator.

◆ initialize() [2/3]

virtual int teca_calendar_util::interval_iterator::initialize ( const teca_metadata md)
virtual

Initialize the iterator from a metadata object following the conventions defined by the teca_cf_reader.

Returns
0 if successfully initialized

◆ initialize() [3/3]

virtual int teca_calendar_util::interval_iterator::initialize ( const teca_metadata md,
long  first_step,
long  last_step 
)
virtual

Initialize the iterator from a metadata object following the conventions defined by the teca_cf_reader.

Parameters
[in]mda metadata object
[in]first_stepthe first step to include in the series or 0 to use all
[in]last_stepthe last step to include in the series or -1 to use all
Returns
0 if successfully initialized

◆ is_valid()

virtual bool teca_calendar_util::interval_iterator::is_valid ( ) const
pure virtual

◆ operator bool()

teca_calendar_util::interval_iterator::operator bool ( ) const
inline
Returns
true if there are more intervals in the series

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