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

Serializable object holding amortization rules. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for AmortizationData:
+ Collaboration diagram for AmortizationData:

Public Member Functions

 AmortizationData ()
 
 AmortizationData (string type, double value, string startDate, string endDate, string frequency, bool underflow)
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
const string & type () const
 FixedAmount, RelativeToInitialNotional, RelativeToPreviousNotional, Annuity. More...
 
double value () const
 Interpretation depending on type() More...
 
const string & startDate () const
 Amortization start date. More...
 
const string & endDate () const
 Amortization end date. More...
 
const string & frequency () const
 Amortization frequency. More...
 
bool underflow () const
 Allow amortization below zero notional if true. More...
 
bool initialized () 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...
 

Private Member Functions

void validate () const
 

Private Attributes

string type_
 
double value_
 
string startDate_
 
string endDate_
 
string frequency_
 
bool underflow_
 
bool initialized_
 

Detailed Description

Serializable object holding amortization rules.

Definition at line 805 of file legdata.hpp.

Constructor & Destructor Documentation

◆ AmortizationData() [1/2]

Definition at line 807 of file legdata.hpp.

◆ AmortizationData() [2/2]

AmortizationData ( string  type,
double  value,
string  startDate,
string  endDate,
string  frequency,
bool  underflow 
)

Definition at line 809 of file legdata.hpp.

812 validate();
813 }
const string & endDate() const
Amortization end date.
Definition: legdata.hpp:825
double value() const
Interpretation depending on type()
Definition: legdata.hpp:821
const string & startDate() const
Amortization start date.
Definition: legdata.hpp:823
const string & type() const
FixedAmount, RelativeToInitialNotional, RelativeToPreviousNotional, Annuity.
Definition: legdata.hpp:819
bool underflow() const
Allow amortization below zero notional if true.
Definition: legdata.hpp:829
const string & frequency() const
Amortization frequency.
Definition: legdata.hpp:827
+ Here is the call graph for this function:

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 698 of file legdata.cpp.

698 {
699 XMLUtils::checkNode(node, "AmortizationData");
700 type_ = XMLUtils::getChildValue(node, "Type");
701 value_ = XMLUtils::getChildValueAsDouble(node, "Value", false, Null<Real>());
702 startDate_ = XMLUtils::getChildValue(node, "StartDate", false);
703 endDate_ = XMLUtils::getChildValue(node, "EndDate", false);
704 frequency_ = XMLUtils::getChildValue(node, "Frequency", false);
705 underflow_ = XMLUtils::getChildValueAsBool(node, "Underflow", false, false);
706 initialized_ = true;
707 validate();
708}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
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
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 710 of file legdata.cpp.

710 {
711 XMLNode* node = doc.allocNode("AmortizationData");
712 XMLUtils::addChild(doc, node, "Type", type_);
713 if (value_ != Null<Real>())
714 XMLUtils::addChild(doc, node, "Value", value_);
715 if (!startDate_.empty())
716 XMLUtils::addChild(doc, node, "StartDate", startDate_);
717 if (!endDate_.empty())
718 XMLUtils::addChild(doc, node, "EndDate", endDate_);
719 if (!frequency_.empty())
720 XMLUtils::addChild(doc, node, "Frequency", frequency_);
721 XMLUtils::addChild(doc, node, "Underflow", underflow_);
722 return node;
723}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ type()

const string & type ( ) const

FixedAmount, RelativeToInitialNotional, RelativeToPreviousNotional, Annuity.

Definition at line 819 of file legdata.hpp.

819{ return type_; }
+ Here is the caller graph for this function:

◆ value()

double value ( ) const

Interpretation depending on type()

Definition at line 821 of file legdata.hpp.

821{ return value_; }

◆ startDate()

const string & startDate ( ) const

Amortization start date.

Definition at line 823 of file legdata.hpp.

823{ return startDate_; }
+ Here is the caller graph for this function:

◆ endDate()

const string & endDate ( ) const

Amortization end date.

Definition at line 825 of file legdata.hpp.

825{ return endDate_; }
+ Here is the caller graph for this function:

◆ frequency()

const string & frequency ( ) const

Amortization frequency.

Definition at line 827 of file legdata.hpp.

827{ return frequency_; }

◆ underflow()

bool underflow ( ) const

Allow amortization below zero notional if true.

Definition at line 829 of file legdata.hpp.

829{ return underflow_; }

◆ initialized()

bool initialized ( ) const

Definition at line 830 of file legdata.hpp.

830{ return initialized_; }
+ Here is the caller graph for this function:

◆ validate()

void validate ( ) const
private

Definition at line 725 of file legdata.cpp.

725 {
726 QL_REQUIRE(type_ == "LinearToMaturity" || value_ != Null<Real>(), "AmortizationData requires Value");
727 QL_REQUIRE(type_ == "LinearToMaturity" || value_ != Null<Real>(), "AmortizationData requires Underflow");
728}
+ Here is the caller graph for this function:

Member Data Documentation

◆ type_

string type_
private

Definition at line 834 of file legdata.hpp.

◆ value_

double value_
private

Definition at line 835 of file legdata.hpp.

◆ startDate_

string startDate_
private

Definition at line 836 of file legdata.hpp.

◆ endDate_

string endDate_
private

Definition at line 837 of file legdata.hpp.

◆ frequency_

string frequency_
private

Definition at line 838 of file legdata.hpp.

◆ underflow_

bool underflow_
private

Definition at line 839 of file legdata.hpp.

◆ initialized_

bool initialized_
private

Definition at line 840 of file legdata.hpp.