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

#include <ored/portfolio/underlying.hpp>

+ Inheritance diagram for InflationUnderlying:
+ Collaboration diagram for InflationUnderlying:

Public Member Functions

 InflationUnderlying ()
 Default Constructor. More...
 
 InflationUnderlying (const std::string &type, const std::string &name, const QuantLib::Real weight, const QuantLib::CPI::InterpolationType &interpolation=QuantLib::CPI::InterpolationType::Flat)
 Constructor with identifier information. More...
 
const QuantLib::CPI::InterpolationType & interpolation () const
 
- Public Member Functions inherited from Underlying
 Underlying ()
 Default Constructor. More...
 
 Underlying (const std::string &type, const std::string &name, const QuantLib::Real weight=QuantLib::Null< QuantLib::Real >())
 Constructor with type, name, weight. More...
 
void setType (const string &type)
 
void setName (const string &name)
 
void setWeight (const QuantLib::Real weight)
 
void setNodeName (const string &nodeName)
 
void setBasicUnderlyingNodeName (const string &basicUnderlyingNodeName)
 
const std::string & type () const
 
virtual const std::string & name () const
 
Real weight () 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

QuantLib::CPI::InterpolationType interpolation_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from Underlying
std::string type_
 
std::string name_
 
Real weight_ = QuantLib::Null<QuantLib::Real>()
 
std::string nodeName_
 
std::string basicUnderlyingNodeName_
 
bool isBasic_ = false
 

Detailed Description

Definition at line 192 of file underlying.hpp.

Constructor & Destructor Documentation

◆ InflationUnderlying() [1/2]

InflationUnderlying ( )
explicit

Default Constructor.

Definition at line 195 of file underlying.hpp.

195: Underlying() { setType("Inflation"); };
Underlying()
Default Constructor.
Definition: underlying.hpp:40
void setType(const string &type)
Definition: underlying.hpp:53
+ Here is the call graph for this function:

◆ InflationUnderlying() [2/2]

InflationUnderlying ( const std::string &  type,
const std::string &  name,
const QuantLib::Real  weight,
const QuantLib::CPI::InterpolationType &  interpolation = QuantLib::CPI::InterpolationType::Flat 
)

Constructor with identifier information.

Definition at line 198 of file underlying.hpp.

QuantLib::CPI::InterpolationType interpolation_
Definition: underlying.hpp:209
const QuantLib::CPI::InterpolationType & interpolation() const
Definition: underlying.hpp:201
const std::string & type() const
Definition: underlying.hpp:63
Real weight() const
Definition: underlying.hpp:65
virtual const std::string & name() const
Definition: underlying.hpp:64

Member Function Documentation

◆ interpolation()

const QuantLib::CPI::InterpolationType & interpolation ( ) const

Definition at line 201 of file underlying.hpp.

201{ return interpolation_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from Underlying.

Definition at line 237 of file underlying.cpp.

237 {
240 isBasic_ = true;
241 } else if (XMLUtils::getNodeName(node) == nodeName_) {
243 // optional
244 std::string interpolationString = XMLUtils::getChildValue(node, "Interpolation", false);
245 if (interpolationString != "")
246 interpolation_ = parseObservationInterpolation(interpolationString);
247 else
248 interpolation_ = QuantLib::CPI::InterpolationType::Flat;
249 isBasic_ = false;
250 } else {
251 QL_FAIL("Need either a Name or Underlying node for InflationUnderlying.");
252 }
253 setType("Inflation");
254}
std::string basicUnderlyingNodeName_
Definition: underlying.hpp:71
std::string nodeName_
Definition: underlying.hpp:71
virtual void fromXML(ore::data::XMLNode *node) override
Definition: underlying.cpp:33
static string getNodeName(XMLNode *n)
Get and set a node's name.
Definition: xmlutils.cpp:473
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
QuantLib::CPI::InterpolationType parseObservationInterpolation(const std::string &s)
Convert string to observation interpolation.
Definition: parsers.cpp:682
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Reimplemented from Underlying.

Definition at line 256 of file underlying.cpp.

256 {
257 XMLNode* node;
258 if (isBasic_) {
259 node = doc.allocNode(basicUnderlyingNodeName_, name_);
260 } else {
261 node = Underlying::toXML(doc);
262 XMLUtils::addChild(doc, node, "Interpolation", std::to_string(interpolation_));
263 }
264 return node;
265}
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: underlying.cpp:42
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

Member Data Documentation

◆ interpolation_

QuantLib::CPI::InterpolationType interpolation_
private

Definition at line 209 of file underlying.hpp.