Skip to content

Commit

Permalink
Remove CPISwap::Type
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jun 1, 2021
1 parent 1e10556 commit ad92492
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
12 changes: 0 additions & 12 deletions ql/instruments/cpiswap.cpp
Expand Up @@ -215,17 +215,5 @@ namespace QuantLib {
fairSpread = Null<Spread>();
}

std::ostream& operator<<(std::ostream& out,
CPISwap::Type t) {
switch (t) {
case CPISwap::Payer:
return out << "Payer";
case CPISwap::Receiver:
return out << "Receiver";
default:
QL_FAIL("unknown CPISwap::Type(" << Integer(t) << ")");
}
}

}

6 changes: 2 additions & 4 deletions ql/instruments/cpiswap.hpp
Expand Up @@ -65,11 +65,11 @@ namespace QuantLib {
*/
class CPISwap : public Swap {
public:
enum Type { Receiver = -1, Payer = 1 };
class arguments;
class results;
class engine;

/*! In this swap, the type (Payer or Receiver) refers to the floating leg. */
CPISwap(Type type,
Real nominal,
bool subtractInflationNominal,
Expand Down Expand Up @@ -188,7 +188,7 @@ namespace QuantLib {
// inline definitions

// inspectors
inline CPISwap::Type CPISwap::type() const { return type_; }
inline Swap::Type CPISwap::type() const { return type_; }
inline Real CPISwap::nominal() const { return nominal_; }
inline bool CPISwap::subtractInflationNominal() const { return subtractInflationNominal_; }

Expand Down Expand Up @@ -219,8 +219,6 @@ namespace QuantLib {
return legs_[1];
}

std::ostream& operator<<(std::ostream& out, CPISwap::Type t);

}

#endif
Expand Down
6 changes: 3 additions & 3 deletions test-suite/inflationcpiswap.cpp
Expand Up @@ -268,7 +268,7 @@ void CPISwapTest::consistency() {

// ZeroInflationSwap aka CPISwap

CPISwap::Type type = CPISwap::Payer;
Swap::Type type = Swap::Payer;
Real nominal = 1000000.0;
bool subtractInflationNominal = true;
// float+spread leg
Expand Down Expand Up @@ -411,7 +411,7 @@ void CPISwapTest::zciisconsistency() {
std::vector<Date> oneDate = {endDate};
Schedule schOneDate(oneDate, cal, paymentConvention);

CPISwap::Type stype = CPISwap::Payer;
Swap::Type stype = Swap::Payer;
Real inflationNominal = nominal;
Real floatNominal = inflationNominal * std::pow(1.0+quote,50);
bool subtractInflationNominal = true;
Expand Down Expand Up @@ -447,7 +447,7 @@ void CPISwapTest::cpibondconsistency() {

// ZeroInflationSwap aka CPISwap

CPISwap::Type type = CPISwap::Payer;
Swap::Type type = Swap::Payer;
Real nominal = 1000000.0;
bool subtractInflationNominal = true;
// float+spread leg
Expand Down

0 comments on commit ad92492

Please sign in to comment.