QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
day counter class More...
#include <daycounter.hpp>
Classes | |
class | Impl |
abstract base class for day counter implementations More... | |
Public Member Functions | |
DayCounter ()=default | |
DayCounter interface | |
bool | empty () const |
Returns whether or not the day counter is initialized. More... | |
std::string | name () const |
Returns the name of the day counter. More... | |
Date::serial_type | dayCount (const Date &, const Date &) const |
Returns the number of days between two dates. More... | |
Time | yearFraction (const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const |
Returns the period between two dates as a fraction of year. More... | |
Protected Member Functions | |
DayCounter (ext::shared_ptr< Impl > impl) | |
Protected Attributes | |
ext::shared_ptr< Impl > | impl_ |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const DayCounter &, const DayCounter &) |
bool | operator!= (const DayCounter &, const DayCounter &) |
std::ostream & | operator<< (std::ostream &, const DayCounter &) |
day counter class
This class provides methods for determining the length of a time period according to given market convention, both as a number of days and as a year fraction.
The Bridge pattern is used to provide the base behavior of the day counter.
Definition at line 44 of file daycounter.hpp.
|
explicitprotected |
This constructor can be invoked by derived classes which define a given implementation.
Definition at line 65 of file daycounter.hpp.
|
default |
The default constructor returns a day counter with a null implementation, which is therefore unusable except as a placeholder.
bool empty | ( | ) | const |
Returns whether or not the day counter is initialized.
Definition at line 113 of file daycounter.hpp.
std::string name | ( | ) | const |
Returns the name of the day counter.
Definition at line 117 of file daycounter.hpp.
Date::serial_type dayCount | ( | const Date & | d1, |
const Date & | d2 | ||
) | const |
Returns the number of days between two dates.
Definition at line 122 of file daycounter.hpp.
Time yearFraction | ( | const Date & | d1, |
const Date & | d2, | ||
const Date & | refPeriodStart = Date() , |
||
const Date & | refPeriodEnd = Date() |
||
) | const |
Returns the period between two dates as a fraction of year.
Definition at line 128 of file daycounter.hpp.
|
related |
Returns true
iff the two day counters belong to the same derived class.
Definition at line 135 of file daycounter.hpp.
|
related |
Definition at line 140 of file daycounter.hpp.
|
related |
Definition at line 144 of file daycounter.hpp.
|
protected |
Definition at line 61 of file daycounter.hpp.