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

#include <ored/configuration/parametricsmileconfiguration.hpp>

+ Inheritance diagram for ParametricSmileConfiguration:
+ Collaboration diagram for ParametricSmileConfiguration:

Classes

class  Calibration
 
class  Parameter
 

Public Member Functions

 ParametricSmileConfiguration ()
 
 ParametricSmileConfiguration (std::vector< Parameter > parameters, Calibration calibration)
 
XMLSerializable interface
void fromXML (ore::data::XMLNode *node) override
 
ore::data::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...
 

Inspectors

std::vector< Parameterparameters_
 
Calibration calibration_
 
const Parameterparameter (const std::string &name) const
 
const Calibrationcalibration () const
 

Detailed Description

Serializable parametric smile configuration

Definition at line 35 of file parametricsmileconfiguration.hpp.

Constructor & Destructor Documentation

◆ ParametricSmileConfiguration() [1/2]

Definition at line 57 of file parametricsmileconfiguration.hpp.

57{}

◆ ParametricSmileConfiguration() [2/2]

ParametricSmileConfiguration ( std::vector< Parameter parameters,
Calibration  calibration 
)

Member Function Documentation

◆ fromXML()

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

Implements XMLSerializable.

Definition at line 60 of file parametricsmileconfiguration.cpp.

60 {
61
62 XMLUtils::checkNode(node, "ParametricSmileConfiguration");
63
64 parameters_.clear();
65
66 if (XMLNode* n = XMLUtils::getChildNode(node, "Parameters")) {
67 for (auto m : XMLUtils::getChildrenNodes(n, "Parameter")) {
68 ParametricSmileConfiguration::Parameter p;
69 p.fromXML(m);
70 parameters_.push_back(p);
71 }
72 }
73
74 if (XMLNode* n = XMLUtils::getChildNode(node, "Calibration")) {
76 }
77}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
Definition: xmlutils.cpp:428
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
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

Implements XMLSerializable.

Definition at line 79 of file parametricsmileconfiguration.cpp.

79 {
80
81 XMLNode* node = doc.allocNode("ParametricSmileConfiguration");
82
83 XMLNode* m = XMLUtils::addChild(doc, node, "Parameters");
84 for (auto const& p : parameters_) {
85 XMLUtils::appendNode(m, p.toXML(doc));
86 }
87
89
90 return node;
91}
ore::data::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
+ Here is the call graph for this function:

◆ parameter()

const ParametricSmileConfiguration::Parameter & parameter ( const std::string &  name) const

Definition at line 93 of file parametricsmileconfiguration.cpp.

93 {
94 auto p =
95 std::find_if(parameters_.begin(), parameters_.end(), [&name](const Parameter& p) { return p.name == name; });
96 QL_REQUIRE(p != parameters_.end(), "ParametricSmileConfiguration: parameter '" << name << "' is not present.");
97 return *p;
98}
string name

◆ calibration()

const ParametricSmileConfiguration::Calibration & calibration ( ) const

Definition at line 100 of file parametricsmileconfiguration.cpp.

100 {
101 return calibration_;
102}

Member Data Documentation

◆ parameters_

std::vector<Parameter> parameters_
private

Definition at line 73 of file parametricsmileconfiguration.hpp.

◆ calibration_

Calibration calibration_
private

Definition at line 74 of file parametricsmileconfiguration.hpp.