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

Serializable Cashflow Leg Data. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for CashflowData:
+ Collaboration diagram for CashflowData:

Public Member Functions

 CashflowData ()
 Default constructor. More...
 
 CashflowData (const vector< double > &amounts, const vector< string > &dates)
 Constructor. More...
 
Inspectors
const vector< double > & amounts () const
 
const vector< string > & dates () 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 > amounts_
 
vector< string > dates_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

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

Detailed Description

Serializable Cashflow Leg Data.

Definition at line 89 of file legdata.hpp.

Constructor & Destructor Documentation

◆ CashflowData() [1/2]

Default constructor.

Definition at line 92 of file legdata.hpp.

92: LegAdditionalData("Cashflow", "CashflowData") {}
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

◆ CashflowData() [2/2]

CashflowData ( const vector< double > &  amounts,
const vector< string > &  dates 
)

Constructor.

Definition at line 94 of file legdata.hpp.

95 : LegAdditionalData("Cashflow", "CashflowData"), amounts_(amounts), dates_(dates) {}
vector< string > dates_
Definition: legdata.hpp:110
vector< double > amounts_
Definition: legdata.hpp:109
const vector< string > & dates() const
Definition: legdata.hpp:100
const vector< double > & amounts() const
Definition: legdata.hpp:99

Member Function Documentation

◆ amounts()

const vector< double > & amounts ( ) const

Definition at line 99 of file legdata.hpp.

99{ return amounts_; }

◆ dates()

const vector< string > & dates ( ) const

Definition at line 100 of file legdata.hpp.

100{ return dates_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 94 of file legdata.cpp.

94 {
95 // allow for empty Cashflow legs without any payments
96 if(node == nullptr)
97 return;
99 amounts_ =
100 XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Cashflow", "Amount", "date", dates_, &parseReal, false);
101
105}
const string & legNodeName() const
Definition: legdata.hpp:70
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
void apply_permutation_in_place(std::vector< T > &vec, const std::vector< std::size_t > &p)
Definition: vectorutils.hpp:51
std::vector< std::size_t > sort_permutation(const std::vector< T > &vec, Compare &compare)
Definition: vectorutils.hpp:38
bool lessThan(const string &s1, const string &s2)
Definition: legdata.cpp:92
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 107 of file legdata.cpp.

107 {
108 XMLNode* node = doc.allocNode(legNodeName());
109 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Cashflow", "Amount", amounts_, "date", dates_);
110 return node;
111}
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
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

Member Data Documentation

◆ amounts_

vector<double> amounts_
private

Definition at line 109 of file legdata.hpp.

◆ dates_

vector<string> dates_
private

Definition at line 110 of file legdata.hpp.