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

#include <ored/model/modeldata.hpp>

+ Inheritance diagram for ModelData:
+ Collaboration diagram for ModelData:

Public Member Functions

 ModelData ()
 Default constructor. More...
 
 ModelData (CalibrationType calibrationType, const std::vector< CalibrationBasket > &calibrationBaskets)
 Detailed constructor. More...
 
Inspectors
CalibrationType calibrationType () const
 
const std::vector< CalibrationBasket > & calibrationBaskets () 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

CalibrationType calibrationType_
 
std::vector< CalibrationBasketcalibrationBaskets_
 
void fromXML (XMLNode *node) override
 
virtual void append (XMLDocument &doc, XMLNode *node) const
 Method used by toXML in derived classes to add the members here to a node. More...
 

Detailed Description

Abstract base class for holding model data.

Definition at line 37 of file modeldata.hpp.

Constructor & Destructor Documentation

◆ ModelData() [1/2]

ModelData ( )

Default constructor.

Definition at line 27 of file modeldata.cpp.

◆ ModelData() [2/2]

ModelData ( CalibrationType  calibrationType,
const std::vector< CalibrationBasket > &  calibrationBaskets 
)

Detailed constructor.

Definition at line 30 of file modeldata.cpp.

CalibrationType calibrationType() const
Definition: modeldata.cpp:34
std::vector< CalibrationBasket > calibrationBaskets_
Definition: modeldata.hpp:66
const std::vector< CalibrationBasket > & calibrationBaskets() const
Definition: modeldata.cpp:38

Member Function Documentation

◆ calibrationType()

CalibrationType calibrationType ( ) const

Definition at line 34 of file modeldata.cpp.

34 {
35 return calibrationType_;
36}

◆ calibrationBaskets()

const vector< CalibrationBasket > & calibrationBaskets ( ) const

Definition at line 38 of file modeldata.cpp.

38 {
40}

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 42 of file modeldata.cpp.

42 {
43
44 calibrationType_ = parseCalibrationType(XMLUtils::getChildValue(node, "CalibrationType", true));
45
46 if (XMLNode* n = XMLUtils::getChildNode(node, "CalibrationBaskets")) {
47 for (XMLNode* cn = XMLUtils::getChildNode(n, "CalibrationBasket"); cn;
48 cn = XMLUtils::getNextSibling(cn, "CalibrationBasket")) {
49 CalibrationBasket cb;
50 cb.fromXML(cn);
51 calibrationBaskets_.push_back(cb);
52 }
53 }
54}
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 * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
Definition: xmlutils.cpp:484
CalibrationType parseCalibrationType(const string &s)
Convert calibration type string into enumerated class value.
Definition: irmodeldata.cpp:47
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:

◆ append()

void append ( XMLDocument doc,
XMLNode node 
) const
protectedvirtual

Method used by toXML in derived classes to add the members here to a node.

Reimplemented in InflationModelData.

Definition at line 56 of file modeldata.cpp.

56 {
57
58 XMLUtils::addGenericChild(doc, node, "CalibrationType", calibrationType_);
59
60 if (!calibrationBaskets_.empty()) {
61 XMLNode* cbsNode = doc.allocNode("CalibrationBaskets");
62 for (const CalibrationBasket& cb : calibrationBaskets_) {
63 XMLUtils::appendNode(cbsNode, cb.toXML(doc));
64 }
65 XMLUtils::appendNode(node, cbsNode);
66 }
67}
static void addGenericChild(XMLDocument &doc, XMLNode *n, const char *name, const T &value)
Adds <Name>p1,p2,p3</Name>
Definition: xmlutils.hpp:137
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

◆ calibrationType_

CalibrationType calibrationType_
private

Definition at line 59 of file modeldata.hpp.

◆ calibrationBaskets_

std::vector<CalibrationBasket> calibrationBaskets_
protected

Definition at line 66 of file modeldata.hpp.