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

Class to hold Underlyings. More...

#include <ored/portfolio/underlying.hpp>

+ Inheritance diagram for Underlying:
+ Collaboration diagram for Underlying:

Public Member Functions

 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...
 
Serialisation
virtual void fromXML (ore::data::XMLNode *node) override
 
virtual ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
Setters
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)
 
- 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::string type_
 
std::string name_
 
Real weight_ = QuantLib::Null<QuantLib::Real>()
 
std::string nodeName_
 
std::string basicUnderlyingNodeName_
 
bool isBasic_ = false
 
const std::string & type () const
 
virtual const std::string & name () const
 
Real weight () const
 

Detailed Description

Class to hold Underlyings.

Definition at line 37 of file underlying.hpp.

Constructor & Destructor Documentation

◆ Underlying() [1/2]

Default Constructor.

Definition at line 40 of file underlying.hpp.

40: nodeName_("Underlying"), basicUnderlyingNodeName_("Name"){};
std::string basicUnderlyingNodeName_
Definition: underlying.hpp:71
std::string nodeName_
Definition: underlying.hpp:71

◆ Underlying() [2/2]

Underlying ( const std::string &  type,
const std::string &  name,
const QuantLib::Real  weight = QuantLib::Null<QuantLib::Real>() 
)

Constructor with type, name, weight.

Definition at line 27 of file underlying.cpp.

27 : Underlying() {
28 type_ = type;
29 name_ = name;
31};
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
Underlying()
Default Constructor.
Definition: underlying.hpp:40
+ Here is the call graph for this function:

Member Function Documentation

◆ fromXML()

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

Implements XMLSerializable.

Reimplemented in BasicUnderlying, EquityUnderlying, CommodityUnderlying, FXUnderlying, InterestRateUnderlying, InflationUnderlying, CreditUnderlying, and BondUnderlying.

Definition at line 33 of file underlying.cpp.

33 {
34 type_ = XMLUtils::getChildValue(node, "Type", true);
35 name_ = XMLUtils::getChildValue(node, "Name", true);
36 if (auto n = XMLUtils::getChildNode(node, "Weight"))
38 else
39 weight_ = 1.0;
40}
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 string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ 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.

Reimplemented in BasicUnderlying, EquityUnderlying, CommodityUnderlying, FXUnderlying, InterestRateUnderlying, InflationUnderlying, CreditUnderlying, and BondUnderlying.

Definition at line 42 of file underlying.cpp.

42 {
43 XMLNode* node = doc.allocNode(nodeName_);
44 XMLUtils::addChild(doc, node, "Type", type_);
45 XMLUtils::addChild(doc, node, "Name", name_);
46 XMLUtils::addChild(doc, node, "Weight", weight_);
47 return node;
48}
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
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:

◆ setType()

void setType ( const string &  type)

Definition at line 53 of file underlying.hpp.

53{ type_ = type; }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setName()

void setName ( const string &  name)

Definition at line 54 of file underlying.hpp.

54{ name_ = name; }
+ Here is the call graph for this function:

◆ setWeight()

void setWeight ( const QuantLib::Real  weight)

Definition at line 55 of file underlying.hpp.

55{ weight_ = weight; }
+ Here is the call graph for this function:

◆ setNodeName()

void setNodeName ( const string &  nodeName)

Definition at line 56 of file underlying.hpp.

56{ nodeName_ = nodeName; }

◆ setBasicUnderlyingNodeName()

void setBasicUnderlyingNodeName ( const string &  basicUnderlyingNodeName)

Definition at line 57 of file underlying.hpp.

57 {
58 basicUnderlyingNodeName_ = basicUnderlyingNodeName;
59 }

◆ type()

const std::string & type ( ) const

Definition at line 63 of file underlying.hpp.

63{ return type_; }
+ Here is the caller graph for this function:

◆ name()

virtual const std::string & name ( ) const
virtual

Reimplemented in EquityUnderlying, and BondUnderlying.

Definition at line 64 of file underlying.hpp.

64{ return name_; }
+ Here is the caller graph for this function:

◆ weight()

Real weight ( ) const

Definition at line 65 of file underlying.hpp.

65{ return weight_; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ type_

std::string type_
protected

Definition at line 69 of file underlying.hpp.

◆ name_

std::string name_
protected

Definition at line 69 of file underlying.hpp.

◆ weight_

Real weight_ = QuantLib::Null<QuantLib::Real>()
protected

Definition at line 70 of file underlying.hpp.

◆ nodeName_

std::string nodeName_
protected

Definition at line 71 of file underlying.hpp.

◆ basicUnderlyingNodeName_

std::string basicUnderlyingNodeName_
protected

Definition at line 71 of file underlying.hpp.

◆ isBasic_

bool isBasic_ = false
protected

Definition at line 72 of file underlying.hpp.