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

Serializable Fixed Leg Data. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for ZeroCouponFixedLegData:
+ Collaboration diagram for ZeroCouponFixedLegData:

Public Member Functions

 ZeroCouponFixedLegData ()
 Default constructor. More...
 
 ZeroCouponFixedLegData (const vector< double > &rates, const vector< string > &rateDates=vector< string >(), const string &compounding="Compounded", const bool subtractNotional=true)
 Constructor. More...
 
Inspectors
const vector< double > & rates () const
 
const vector< string > & rateDates () const
 
const string & compounding () const
 
const boolsubtractNotional () const
 
- Public Member Functions inherited from LegAdditionalData
 LegAdditionalData (const string &legType, const string &legNodeName)
 
 LegAdditionalData (const string &legType)
 
const string & legType () const
 
const string & legNodeName () const
 
const std::set< std::string > & indices () 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

vector< double > rates_
 
vector< string > rateDates_
 
string compounding_
 
bool subtractNotional_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from LegAdditionalData
std::set< std::string > indices_
 

Detailed Description

Serializable Fixed Leg Data.

Definition at line 145 of file legdata.hpp.

Constructor & Destructor Documentation

◆ ZeroCouponFixedLegData() [1/2]

Default constructor.

Definition at line 148 of file legdata.hpp.

148: LegAdditionalData("ZeroCouponFixed"), subtractNotional_(true) {}
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

◆ ZeroCouponFixedLegData() [2/2]

ZeroCouponFixedLegData ( const vector< double > &  rates,
const vector< string > &  rateDates = vector<string>(),
const string &  compounding = "Compounded",
const bool  subtractNotional = true 
)

Constructor.

Definition at line 150 of file legdata.hpp.

const vector< double > & rates() const
Definition: legdata.hpp:157
const bool & subtractNotional() const
Definition: legdata.hpp:160
const vector< string > & rateDates() const
Definition: legdata.hpp:158
const string & compounding() const
Definition: legdata.hpp:159

Member Function Documentation

◆ rates()

const vector< double > & rates ( ) const

Definition at line 157 of file legdata.hpp.

157{ return rates_; }

◆ rateDates()

const vector< string > & rateDates ( ) const

Definition at line 158 of file legdata.hpp.

158{ return rateDates_; }

◆ compounding()

const string & compounding ( ) const

Definition at line 159 of file legdata.hpp.

159{ return compounding_; }

◆ subtractNotional()

const bool & subtractNotional ( ) const

Definition at line 160 of file legdata.hpp.

160{ return subtractNotional_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 125 of file legdata.cpp.

125 {
127 rates_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Rates", "Rate", "startDate", rateDates_, &parseReal,
128 true);
129 XMLNode* compNode = XMLUtils::getChildNode(node, "Compounding");
130 if (compNode)
131 compounding_ = XMLUtils::getChildValue(node, "Compounding", true);
132 else
133 compounding_ = "Compounded";
134 QL_REQUIRE(compounding_ == "Compounded" || compounding_ == "Simple",
135 "Compounding method " << compounding_ << " not supported");
136 XMLNode* subtractNotionalNode = XMLUtils::getChildNode(node, "SubtractNotional");
137 if (subtractNotionalNode)
138 subtractNotional_ = XMLUtils::getChildValueAsBool(node, "SubtractNotional", true);
139 else
140 subtractNotional_ = true;
141}
const string & legNodeName() const
Definition: legdata.hpp:70
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
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 143 of file legdata.cpp.

143 {
144 XMLNode* node = doc.allocNode(legNodeName());
145 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Rates", "Rate", rates_, "startDate", rateDates_);
146 XMLUtils::addChild(doc, node, "Compounding", compounding_);
147 XMLUtils::addChild(doc, node, "SubtractNotional", subtractNotional_);
148 return node;
149}
static void addChildrenWithOptionalAttributes(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
Definition: xmlutils.cpp:542
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
+ Here is the call graph for this function:

Member Data Documentation

◆ rates_

vector<double> rates_
private

Definition at line 169 of file legdata.hpp.

◆ rateDates_

vector<string> rateDates_
private

Definition at line 170 of file legdata.hpp.

◆ compounding_

string compounding_
private

Definition at line 171 of file legdata.hpp.

◆ subtractNotional_

bool subtractNotional_
private

Definition at line 172 of file legdata.hpp.