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

#include <ored/portfolio/creditdefaultswapdata.hpp>

+ Inheritance diagram for CdsReferenceInformation:
+ Collaboration diagram for CdsReferenceInformation:

Public Member Functions

 CdsReferenceInformation ()
 Default constructor. More...
 
 CdsReferenceInformation (const std::string &referenceEntityId, CdsTier tier, const QuantLib::Currency &currency, boost::optional< CdsDocClause > docClause=boost::none)
 Detailed constructor. More...
 
XMLSerializable interface
void fromXML (XMLNode *node) override
 
XMLNodetoXML (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...
 

Inspectors

std::string referenceEntityId_
 
CdsTier tier_
 
QuantLib::Currency currency_
 
boost::optional< CdsDocClausedocClause_
 
std::string id_
 
const std::string & referenceEntityId () const
 
CdsTier tier () const
 
const QuantLib::Currency & currency () const
 
bool hasDocClause () const
 
CdsDocClause docClause () const
 
const std::string & id () const
 
void populateId ()
 Populate the id_ member. More...
 

Detailed Description

Serializable reference information

Definition at line 76 of file creditdefaultswapdata.hpp.

Constructor & Destructor Documentation

◆ CdsReferenceInformation() [1/2]

Default constructor.

Definition at line 407 of file creditdefaultswapdata.cpp.

◆ CdsReferenceInformation() [2/2]

CdsReferenceInformation ( const std::string &  referenceEntityId,
CdsTier  tier,
const QuantLib::Currency &  currency,
boost::optional< CdsDocClause docClause = boost::none 
)

Detailed constructor.

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 415 of file creditdefaultswapdata.cpp.

415 {
416 XMLUtils::checkNode(node, "ReferenceInformation");
417 referenceEntityId_ = XMLUtils::getChildValue(node, "ReferenceEntityId", true);
418 tier_ = parseCdsTier(XMLUtils::getChildValue(node, "Tier", true));
419 currency_ = parseCurrency(XMLUtils::getChildValue(node, "Currency", true));
420 if (auto s = XMLUtils::getChildValue(node, "DocClause", false); !s.empty()) {
422 }
423 populateId();
424}
void populateId()
Populate the id_ member.
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
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:290
CdsDocClause parseCdsDocClause(const string &s)
CdsTier parseCdsTier(const string &s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 426 of file creditdefaultswapdata.cpp.

426 {
427 XMLNode* node = doc.allocNode("ReferenceInformation");
428 XMLUtils::addChild(doc, node, "ReferenceEntityId", referenceEntityId_);
429 XMLUtils::addChild(doc, node, "Tier", to_string(tier_));
430 XMLUtils::addChild(doc, node, "Currency", currency_.code());
431 if(docClause_)
432 XMLUtils::addChild(doc, node, "DocClause", to_string(*docClause_));
433 return node;
434}
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:

◆ referenceEntityId()

const std::string & referenceEntityId ( ) const

Definition at line 93 of file creditdefaultswapdata.hpp.

93{ return referenceEntityId_; }
+ Here is the caller graph for this function:

◆ tier()

CdsTier tier ( ) const

Definition at line 94 of file creditdefaultswapdata.hpp.

94{ return tier_; }
+ Here is the caller graph for this function:

◆ currency()

const QuantLib::Currency & currency ( ) const

Definition at line 95 of file creditdefaultswapdata.hpp.

95{ return currency_; }
+ Here is the caller graph for this function:

◆ hasDocClause()

bool hasDocClause ( ) const

Definition at line 447 of file creditdefaultswapdata.cpp.

447{ return docClause_ != boost::none; }

◆ docClause()

CdsDocClause docClause ( ) const

Definition at line 442 of file creditdefaultswapdata.cpp.

442 {
443 QL_REQUIRE(docClause_, "CdsReferenceInforamtion::docClause(): docClause not set.");
444 return *docClause_;
445}
+ Here is the caller graph for this function:

◆ id()

const std::string & id ( ) const

Give back the ID for the CdsReferenceInformation object. The id is the concatenation of the string representation of the object's members using the | character as a delimiter.

Definition at line 103 of file creditdefaultswapdata.hpp.

+ Here is the caller graph for this function:

◆ populateId()

void populateId ( )
private

Populate the id_ member.

Definition at line 436 of file creditdefaultswapdata.cpp.

436 {
437 id_ = referenceEntityId_ + "|" + to_string(tier_) + "|" + currency_.code();
438 if (docClause_)
439 id_ += "|" + to_string(*docClause_);
440}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ referenceEntityId_

std::string referenceEntityId_
private

Definition at line 106 of file creditdefaultswapdata.hpp.

◆ tier_

CdsTier tier_
private

Definition at line 107 of file creditdefaultswapdata.hpp.

◆ currency_

QuantLib::Currency currency_
private

Definition at line 108 of file creditdefaultswapdata.hpp.

◆ docClause_

boost::optional<CdsDocClause> docClause_
private

Definition at line 109 of file creditdefaultswapdata.hpp.

◆ id_

std::string id_
private

Definition at line 110 of file creditdefaultswapdata.hpp.