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

#include <ored/portfolio/basketdata.hpp>

+ Inheritance diagram for BasketData:
+ Collaboration diagram for BasketData:

Public Member Functions

 BasketData ()
 Default constructor. More...
 
 BasketData (const std::vector< BasketConstituent > &constituents)
 Constructor taking explicit set of basket constituents. More...
 
Inspectors
const std::vector< BasketConstituent > & constituents () 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

std::vector< BasketConstituentconstituents_
 
void fromXML (ore::data::XMLNode *node) override
 
ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 

Detailed Description

Serializable credit basket data

Definition at line 128 of file basketdata.hpp.

Constructor & Destructor Documentation

◆ BasketData() [1/2]

Default constructor.

Definition at line 259 of file basketdata.cpp.

259{}

◆ BasketData() [2/2]

BasketData ( const std::vector< BasketConstituent > &  constituents)

Constructor taking explicit set of basket constituents.

Definition at line 261 of file basketdata.cpp.

const std::vector< BasketConstituent > & constituents() const
Definition: basketdata.cpp:263
std::vector< BasketConstituent > constituents_
Definition: basketdata.hpp:148

Member Function Documentation

◆ constituents()

const vector< BasketConstituent > & constituents ( ) const

Definition at line 263 of file basketdata.cpp.

263{ return constituents_; }
+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( ore::data::XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 265 of file basketdata.cpp.

265 {
266
267 XMLUtils::checkNode(node, "BasketData");
268
269 constituents_.clear();
270 for (XMLNode* child = XMLUtils::getChildNode(node, "Name"); child; child = XMLUtils::getNextSibling(child)) {
271 BasketConstituent constituent;
272 constituent.fromXML(child);
273 constituents_.push_back(constituent);
274 }
275}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
Definition: xmlutils.cpp:484
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

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

Implements XMLSerializable.

Definition at line 277 of file basketdata.cpp.

277 {
278
279 XMLNode* node = doc.allocNode("BasketData");
280
281 for (auto c : constituents_) {
282 auto cNode = c.toXML(doc);
283 XMLUtils::appendNode(node, cNode);
284 }
285
286 return node;
287}
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ constituents_

std::vector<BasketConstituent> constituents_
private

Definition at line 148 of file basketdata.hpp.