Container for historical data. More...
#include <ql/timeseries.hpp>
Public Types | |
typedef Date | key_type |
typedef T | value_type |
Public Member Functions | |
TimeSeries () | |
template<class DateIterator , class ValueIterator > | |
TimeSeries (DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin) | |
template<class ValueIterator > | |
TimeSeries (const Date &firstDate, ValueIterator begin, ValueIterator end) | |
Inspectors | |
Date | firstDate () const |
returns the first date for which a historical datum exists | |
Date | lastDate () const |
returns the last date for which a historical datum exists | |
Size | size () const |
returns the number of historical data including null ones | |
bool | empty () const |
returns whether the series contains any data | |
Historical data access | |
T | operator[] (const Date &d) const |
returns the (possibly null) datum corresponding to the given date | |
T & | operator[] (const Date &d) |
Utilities | |
const_iterator | find (const Date &) |
std::vector< Date > | dates () const |
returns the dates for which historical data exist | |
std::vector< T > | values () const |
returns the historical data | |
Container for historical data.
This class acts as a generic repository for a set of historical data. Any single datum can be accessed through its date, while sets of consecutive data can be accessed through iterators.
Container
type must satisfy the requirements set by the C++ standard for associative containers. TimeSeries | ( | ) |
Default constructor
TimeSeries | ( | DateIterator | dBegin, |
DateIterator | dEnd, | ||
ValueIterator | vBegin | ||
) |
This constructor initializes the history with a set of values passed as two sequences, the first containing dates and the second containing corresponding values.
TimeSeries | ( | const Date & | firstDate, |
ValueIterator | begin, | ||
ValueIterator | end | ||
) |
This constructor initializes the history with a set of values. Such values are assigned to a corresponding number of consecutive dates starting from firstDate included.