Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
convertiblebondreferencedata.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
21
22namespace ore {
23namespace data {
24
25// Convertible Bond
28 XMLNode* innerNode = XMLUtils::getChildNode(node, "ConvertibleBondReferenceData");
29 bondData_.fromXML(XMLUtils::getChildNode(innerNode, "BondData"));
30 if (auto n = XMLUtils::getChildNode(innerNode, "CallData")) {
31 if (!XMLUtils::getChildrenNodes(n, "").empty()) {
33 }
34 }
35 if (auto n = XMLUtils::getChildNode(innerNode, "PutData")) {
36 if (!XMLUtils::getChildrenNodes(n, "").empty())
38 }
39 if (auto n = XMLUtils::getChildNode(innerNode, "ConversionData")) {
40 if (!XMLUtils::getChildrenNodes(n, "").empty())
42 }
43 if (auto n = XMLUtils::getChildNode(innerNode, "DividendProtectionData")) {
44 if (!XMLUtils::getChildrenNodes(n, "").empty())
46 }
47 detachable_ = XMLUtils::getChildValue(innerNode, "Detachable", false);
48}
49
51 XMLNode* node0 = ReferenceDatum::toXML(doc);
52 XMLNode* node = XMLUtils::addChild(doc, node0, "ConvertibleBondReferenceData");
62 if (!detachable_.empty())
63 XMLUtils::addChild(doc, node, "Detachable");
64 return node0;
65}
66
67} // namespace data
68} // namespace ore
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ConvertibleBondData::DividendProtectionData dividendProtectionData_
ConvertibleBondData::CallabilityData callData_
ConvertibleBondData::CallabilityData putData_
ConvertibleBondData::ConversionData conversionData_
XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
Definition: xmlutils.cpp:428
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
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
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
string conversion utilities