Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CpiCapFloor Class Reference

#include <ored/model/calibrationinstruments/cpicapfloor.hpp>

+ Inheritance diagram for CpiCapFloor:
+ Collaboration diagram for CpiCapFloor:

Public Member Functions

 CpiCapFloor ()
 Default constructor. More...
 
 CpiCapFloor (QuantLib::CapFloor::Type type, const boost::variant< QuantLib::Date, QuantLib::Period > &maturity, const QuantLib::ext::shared_ptr< BaseStrike > &strike)
 Detailed constructor. More...
 
Inspectors
QuantLib::CapFloor::Type type () const
 
const boost::variant< QuantLib::Date, QuantLib::Period > & maturity () const
 
const QuantLib::ext::shared_ptr< BaseStrike > & strike () const
 
- Public Member Functions inherited from CalibrationInstrument
 CalibrationInstrument (const std::string &instrumentType)
 Constructor. More...
 
virtual ~CalibrationInstrument ()
 Destructor. More...
 
const std::string & instrumentType () const
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Serialisation

QuantLib::CapFloor::Type type_
 
boost::variant< QuantLib::Date, QuantLib::Period > maturity_
 
QuantLib::ext::shared_ptr< BaseStrikestrike_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from CalibrationInstrument
std::string instrumentType_
 

Detailed Description

Class for holding details of a CPI cap floor calibration instrument.

Definition at line 40 of file cpicapfloor.hpp.

Constructor & Destructor Documentation

◆ CpiCapFloor() [1/2]

Default constructor.

Definition at line 30 of file cpicapfloor.cpp.

30: CalibrationInstrument("CpiCapFloor"), type_(CapFloor::Floor) {}
CalibrationInstrument(const std::string &instrumentType)
Constructor.
QuantLib::CapFloor::Type type_
Definition: cpicapfloor.hpp:64

◆ CpiCapFloor() [2/2]

CpiCapFloor ( QuantLib::CapFloor::Type  type,
const boost::variant< QuantLib::Date, QuantLib::Period > &  maturity,
const QuantLib::ext::shared_ptr< BaseStrike > &  strike 
)

Detailed constructor.

Member Function Documentation

◆ type()

CapFloor::Type type ( ) const

Definition at line 40 of file cpicapfloor.cpp.

40 {
41 return type_;
42}

◆ maturity()

const boost::variant< Date, Period > & maturity ( ) const

Definition at line 44 of file cpicapfloor.cpp.

44 {
45 return maturity_;
46}
boost::variant< QuantLib::Date, QuantLib::Period > maturity_
Definition: cpicapfloor.hpp:65

◆ strike()

const QuantLib::ext::shared_ptr< BaseStrike > & strike ( ) const

Definition at line 48 of file cpicapfloor.cpp.

48{ return strike_; }
QuantLib::ext::shared_ptr< BaseStrike > strike_
Definition: cpicapfloor.hpp:66

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 50 of file cpicapfloor.cpp.

50 {
52 type_ = parseCapFloorType(XMLUtils::getChildValue(node, "Type", true));
53 maturity_ = parseDateOrPeriod(XMLUtils::getChildValue(node, "Maturity", true));
54 strike_ = parseBaseStrike(XMLUtils::getChildValue(node, "Strike", true));
55}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod(const string &s)
Convert text to QuantLib::Period or QuantLib::Date.
Definition: parsers.cpp:493
CapFloor::Type parseCapFloorType(const string &s)
Definition: parsers.cpp:815
QuantLib::ext::shared_ptr< BaseStrike > parseBaseStrike(const string &strStrike)
Parse a Strike from its string representation, strStrike.
Definition: strike.cpp:262
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 57 of file cpicapfloor.cpp.

57 {
58 XMLNode* node = doc.allocNode(instrumentType_);
59 XMLUtils::addChild(doc, node, "Type", to_string(type_));
60 XMLUtils::addChild(doc, node, "Maturity", to_string(maturity_));
61 XMLUtils::addChild(doc, node, "Strike", strike_->toString());
62 return node;
63}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

Member Data Documentation

◆ type_

QuantLib::CapFloor::Type type_
private

Definition at line 64 of file cpicapfloor.hpp.

◆ maturity_

boost::variant<QuantLib::Date, QuantLib::Period> maturity_
private

Definition at line 65 of file cpicapfloor.hpp.

◆ strike_

QuantLib::ext::shared_ptr<BaseStrike> strike_
private

Definition at line 66 of file cpicapfloor.hpp.