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

#include <ored/portfolio/trademonetary.hpp>

+ Inheritance diagram for TradeMonetary:
+ Collaboration diagram for TradeMonetary:

Public Member Functions

 TradeMonetary ()
 
 TradeMonetary (const QuantLib::Real &value, std::string currency=std::string())
 
 TradeMonetary (const std::string &valueString)
 
void fromXMLNode (XMLNode *node)
 
void toXMLNode (XMLDocument &doc, XMLNode *node)
 
bool empty () const
 
QuantLib::Real value () const
 
const string & valueString () const
 
std::string currency () const
 
void setCurrency (const std::string &currency)
 
void setValue (const QuantLib::Real &value)
 

Protected Attributes

QuantLib::Real value_ = QuantLib::Null<QuantLib::Real>()
 
std::string valueString_
 store a string version of the value, this ensures toXML values matches fromXML input More...
 
std::string currency_
 

Detailed Description

Definition at line 31 of file trademonetary.hpp.

Constructor & Destructor Documentation

◆ TradeMonetary() [1/3]

Definition at line 34 of file trademonetary.hpp.

34{};

◆ TradeMonetary() [2/3]

TradeMonetary ( const QuantLib::Real &  value,
std::string  currency = std::string() 
)

Definition at line 36 of file trademonetary.hpp.

39 };
std::string valueString_
store a string version of the value, this ensures toXML values matches fromXML input
std::string currency() const
QuantLib::Real value() const
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ TradeMonetary() [3/3]

TradeMonetary ( const std::string &  valueString)

Definition at line 40 of file trademonetary.hpp.

42 };
const string & valueString() const
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ Here is the call graph for this function:

Member Function Documentation

◆ fromXMLNode()

void fromXMLNode ( XMLNode node)

Definition at line 26 of file trademonetary.cpp.

26 {
27 currency_ = XMLUtils::getChildValue(node, "Currency", false);
28 valueString_ = XMLUtils::getChildValue(node, "Value", true);
30}
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXMLNode()

void toXMLNode ( XMLDocument doc,
XMLNode node 
)

Definition at line 32 of file trademonetary.cpp.

32 {
33 XMLUtils::addChild(doc, node, "Value", valueString_);
34 XMLUtils::addChild(doc, node, "Currency", currency_);
35}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

bool empty ( ) const

Definition at line 47 of file trademonetary.hpp.

47{ return value_ == QuantLib::Null<QuantLib::Real>(); };

◆ value()

QuantLib::Real value ( ) const

Definition at line 44 of file trademonetary.cpp.

44 {
45 if (currency_.empty())
46 return value_;
47 else
49}
QuantLib::Real convertMinorToMajorCurrency(const std::string &s, QuantLib::Real value)
Convert a value from a minor ccy to major.
Definition: parsers.cpp:324
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valueString()

const string & valueString ( ) const

Definition at line 49 of file trademonetary.hpp.

49{ return valueString_; }

◆ currency()

std::string currency ( ) const

Definition at line 37 of file trademonetary.cpp.

37 {
38 if (!currency_.empty())
40 else
41 return currency_;
42}
Currency parseCurrencyWithMinors(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:310
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrency()

void setCurrency ( const std::string &  currency)

Definition at line 51 of file trademonetary.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

void setValue ( const QuantLib::Real &  value)

Definition at line 52 of file trademonetary.hpp.

52{ value_ = value; }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ value_

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

Definition at line 55 of file trademonetary.hpp.

◆ valueString_

std::string valueString_
protected

store a string version of the value, this ensures toXML values matches fromXML input

Definition at line 57 of file trademonetary.hpp.

◆ currency_

std::string currency_
protected

Definition at line 58 of file trademonetary.hpp.