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

CreditIndex Reference data, contains the names and weights of a credit index. More...

#include <ored/portfolio/referencedata.hpp>

+ Inheritance diagram for CreditReferenceDatum:
+ Collaboration diagram for CreditReferenceDatum:

Classes

struct  CreditData
 

Public Member Functions

 CreditReferenceDatum ()
 
 CreditReferenceDatum (const string &id)
 
 CreditReferenceDatum (const string &id, const QuantLib::Date &validFrom)
 
 CreditReferenceDatum (const string &id, const CreditData &creditData)
 
 CreditReferenceDatum (const string &id, const QuantLib::Date &validFrom, const CreditData &creditData)
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
const CreditDatacreditData () const
 
void setCreditData (const CreditData &creditData)
 
- Public Member Functions inherited from ReferenceDatum
 ReferenceDatum ()
 Default Constructor. More...
 
 ReferenceDatum (const std::string &type, const std::string &id)
 Base class constructor. More...
 
 ReferenceDatum (const std::string &type, const std::string &id, const QuantLib::Date &validFrom)
 Base class constructor. More...
 
void setType (const string &type)
 setters More...
 
void setId (const string &id)
 
void setValidFrom (const QuantLib::Date &validFrom)
 
const std::string & type () const
 getters More...
 
const std::string & id () const
 
const QuantLib::Date & validFrom () const
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
- 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...
 

Static Public Attributes

static constexpr const char * TYPE = "Credit"
 

Private Attributes

CreditData creditData_
 

Detailed Description

CreditIndex Reference data, contains the names and weights of a credit index.

Definition at line 426 of file referencedata.hpp.

Constructor & Destructor Documentation

◆ CreditReferenceDatum() [1/5]

Definition at line 439 of file referencedata.hpp.

439{}

◆ CreditReferenceDatum() [2/5]

CreditReferenceDatum ( const string &  id)

Definition at line 441 of file referencedata.hpp.

441: ReferenceDatum(TYPE, id) {}
static constexpr const char * TYPE
ReferenceDatum()
Default Constructor.

◆ CreditReferenceDatum() [3/5]

CreditReferenceDatum ( const string &  id,
const QuantLib::Date &  validFrom 
)

Definition at line 443 of file referencedata.hpp.

const QuantLib::Date & validFrom() const

◆ CreditReferenceDatum() [4/5]

CreditReferenceDatum ( const string &  id,
const CreditData creditData 
)

Definition at line 445 of file referencedata.hpp.

◆ CreditReferenceDatum() [5/5]

CreditReferenceDatum ( const string &  id,
const QuantLib::Date &  validFrom,
const CreditData creditData 
)

Definition at line 448 of file referencedata.hpp.

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from ReferenceDatum.

Definition at line 521 of file referencedata.cpp.

521 {
523 XMLNode* innerNode = XMLUtils::getChildNode(node, "CreditReferenceData");
524 QL_REQUIRE(innerNode, "No CreditReferenceData node");
525
526 creditData_.name = XMLUtils::getChildValue(innerNode, "Name", true);
527 creditData_.group = XMLUtils::getChildValue(innerNode, "Group", false);
528 creditData_.successor = XMLUtils::getChildValue(innerNode, "Successor", false);
529 creditData_.predecessor = XMLUtils::getChildValue(innerNode, "Predecessor", false);
531 parseDate(XMLUtils::getChildValue(innerNode, "SuccessorImplementationDate", false));
533 parseDate(XMLUtils::getChildValue(innerNode, "PredecessorImplementationDate", false));
534 creditData_.entityType = (XMLUtils::getChildValue(innerNode, "EntityType", false) == "Corp."||
535 XMLUtils::getChildValue(innerNode, "EntityType", false) == "Corp")
536 ? "Corporate"
537 : XMLUtils::getChildValue(innerNode, "EntityType", false);
538}
void fromXML(XMLNode *node) override
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( ore::data::XMLDocument doc) const
overridevirtual

Reimplemented from ReferenceDatum.

Definition at line 540 of file referencedata.cpp.

540 {
541 XMLNode* node = ReferenceDatum::toXML(doc);
542 XMLNode* creditNode = doc.allocNode("CreditReferenceData");
543 XMLUtils::appendNode(node, creditNode);
544 XMLUtils::addChild(doc, creditNode, "Name", creditData_.name);
545 XMLUtils::addChild(doc, creditNode, "Group", creditData_.group);
546 XMLUtils::addChild(doc, creditNode, "Successor", creditData_.successor);
547 XMLUtils::addChild(doc, creditNode, "Predecessor", creditData_.predecessor);
549 XMLUtils::addChild(doc, creditNode, "SuccessorImplementationDate",
552 XMLUtils::addChild(doc, creditNode, "PredecessorImplementationDate",
554 XMLUtils::addChild(doc, creditNode, "EntityType", creditData_.entityType);
555 return node;
556}
XMLNode * toXML(ore::data::XMLDocument &doc) const override
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ creditData()

const CreditData & creditData ( ) const

Definition at line 454 of file referencedata.hpp.

454{ return creditData_; }
+ Here is the caller graph for this function:

◆ setCreditData()

void setCreditData ( const CreditData creditData)

Definition at line 455 of file referencedata.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ TYPE

constexpr const char* TYPE = "Credit"
staticconstexpr

Definition at line 428 of file referencedata.hpp.

◆ creditData_

CreditData creditData_
private

Definition at line 458 of file referencedata.hpp.