Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
trademonetary.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19#pragma once
20
24
27
28namespace ore {
29namespace data {
30
32
33public:
35
36 TradeMonetary(const QuantLib::Real& value, std::string currency = std::string())
39 };
42 };
43
44 void fromXMLNode(XMLNode* node);
45 void toXMLNode(XMLDocument& doc, XMLNode* node);
46
47 bool empty() const { return value_ == QuantLib::Null<QuantLib::Real>(); };
48 QuantLib::Real value() const;
49 const string& valueString() const { return valueString_; }
50 std::string currency() const;
51 void setCurrency(const std::string& currency) { currency_ = currency; }
52 void setValue(const QuantLib::Real& value) { value_ = value; }
53
54protected:
55 QuantLib::Real value_ = QuantLib::Null<QuantLib::Real>();
56 //! store a string version of the value, this ensures toXML values matches fromXML input
57 std::string valueString_;
58 std::string currency_;
59};
60
61} // namespace data
62} // namespace ore
std::string valueString_
store a string version of the value, this ensures toXML values matches fromXML input
std::string currency() const
TradeMonetary(const QuantLib::Real &value, std::string currency=std::string())
void setCurrency(const std::string &currency)
const string & valueString() const
void fromXMLNode(XMLNode *node)
TradeMonetary(const std::string &valueString)
QuantLib::Real value() const
void setValue(const QuantLib::Real &value)
void toXMLNode(XMLDocument &doc, XMLNode *node)
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
@ data
Definition: log.hpp:77
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.
string conversion utilities
XML utility functions.