Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cashflowtable.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2014 - 2016 Quaternion Risk Management Ltd.
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/cashflows/cashflowtable.hpp
20 \brief Cashflow table to store cashflow calculation results
21*/
22
23#ifndef quantext_cashflow_table_hpp
24#define quantext_cashflow_table_hpp
25
26#include <vector>
27
28#include <ql/qldefines.hpp>
29#include <ql/time/date.hpp>
30
31namespace QuantExt {
32
33//! Class representing the row of a cashflow table
35public:
36 //! Default constructor sets all variables to Null value
38 /** \name Initialisers
39 * Functions to initialise the members
40 */
41 //@{
42 CashflowRow& withStartDate(const QuantLib::Date& startDate);
43 CashflowRow& withEndDate(const QuantLib::Date& endDate);
47 CashflowRow& withAllInRate(QuantLib::Rate allInRate);
48 CashflowRow& withRate(QuantLib::Rate rate);
49 CashflowRow& withSpread(QuantLib::Spread spread);
50 CashflowRow& withDiscount(QuantLib::DiscountFactor discount);
51 //@}
52 /** \name Inspectors
53 * Functions to retrieve the members
54 */
55 //@{
56 const QuantLib::Date& startDate() const { return startDate_; }
57 const QuantLib::Date& endDate() const { return endDate_; }
58 QuantLib::Real startNotional() const { return startNotional_; }
59 QuantLib::Real endNotional() const { return endNotional_; }
60 QuantLib::Real couponAmount() const { return couponAmount_; }
61 QuantLib::Rate allInRate() const { return allInRate_; }
62 QuantLib::Rate rate() const { return rate_; }
63 QuantLib::Spread spread() const { return spread_; }
64 QuantLib::DiscountFactor discount() const { return discount_; }
65 //@}
66private:
67 QuantLib::Date startDate_;
68 QuantLib::Date endDate_;
69 QuantLib::Real startNotional_;
70 QuantLib::Real endNotional_;
71 QuantLib::Real couponAmount_;
72 QuantLib::Rate allInRate_;
73 QuantLib::Rate rate_;
74 QuantLib::Spread spread_;
75 QuantLib::DiscountFactor discount_;
76};
77
78//! Class representing the contents of a cashflow table
80public:
81 //! Default constructor to create empty table
83 //! Add a row to the cashflow table
84 void add(const CashflowRow& cashflowRow);
85 //! Return the number of rows in the cashflow table
86 QuantLib::Size size() const;
87 //! Retrieve row \p i from the cashflow table
88 const CashflowRow& operator[](QuantLib::Size i) const;
89 CashflowRow& operator[](QuantLib::Size i);
90
91private:
92 std::vector<CashflowRow> rows_;
93};
94} // namespace QuantExt
95
96#endif
Class representing the row of a cashflow table.
QuantLib::Real startNotional() const
CashflowRow & withStartDate(const QuantLib::Date &startDate)
const QuantLib::Date & endDate() const
QuantLib::Date endDate_
QuantLib::Real couponAmount_
QuantLib::Spread spread() const
const QuantLib::Date & startDate() const
QuantLib::Spread spread_
QuantLib::DiscountFactor discount() const
CashflowRow & withCouponAmount(QuantLib::Real couponAmount)
QuantLib::Real couponAmount() const
CashflowRow & withDiscount(QuantLib::DiscountFactor discount)
QuantLib::DiscountFactor discount_
CashflowRow & withAllInRate(QuantLib::Rate allInRate)
CashflowRow()
Default constructor sets all variables to Null value.
CashflowRow & withSpread(QuantLib::Spread spread)
CashflowRow & withEndDate(const QuantLib::Date &endDate)
CashflowRow & withEndNotional(QuantLib::Real endNotional)
QuantLib::Real endNotional() const
QuantLib::Real startNotional_
QuantLib::Real endNotional_
QuantLib::Rate allInRate_
CashflowRow & withStartNotional(QuantLib::Real startNotional)
CashflowRow & withRate(QuantLib::Rate rate)
QuantLib::Date startDate_
QuantLib::Rate rate() const
QuantLib::Rate allInRate() const
QuantLib::Rate rate_
Class representing the contents of a cashflow table.
std::vector< CashflowRow > rows_
void add(const CashflowRow &cashflowRow)
Add a row to the cashflow table.
CashflowTable()
Default constructor to create empty table.
QuantLib::Size size() const
Return the number of rows in the cashflow table.
const CashflowRow & operator[](QuantLib::Size i) const
Retrieve row i from the cashflow table.
CashflowRow & operator[](QuantLib::Size i)