Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
nettingsetdetails.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/*! \file ored/portfolio/nettingsetdetails.hpp
20 \brief netting set details data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
26#include <map>
28#include <set>
29
32using std::map;
33using std::set;
34using std::string;
35
36namespace ore {
37namespace data {
38
39//! Serializable object holding netting set identification data
41public:
42 //! Default constructor
44 : nettingSetId_(string()), agreementType_(string()), callType_(string()), initialMarginType_(string()),
45 legalEntityId_(string()){};
46
47 //! Constructor with all fields
48 NettingSetDetails(const string& nettingSetId, const string& agreementType = "", const string& callType = "",
49 const string& initialMarginType = "", const string& legalEntityId = "")
52
53 //! Constructor to reconstruct NettingSetDetails from map (field name to field value)
54 NettingSetDetails(const map<string, string>& nettingSetMap);
55
56 //! \name Serialisation
57 //@{
58 virtual void fromXML(XMLNode* node) override;
59 virtual XMLNode* toXML(XMLDocument& doc) const override;
60 //@}
61
62 //! \name Inspectors
63 //@{
64 const string& nettingSetId() const { return nettingSetId_; }
65 const string& agreementType() const { return agreementType_; }
66 const string& callType() const { return callType_; }
67 const string& initialMarginType() const { return initialMarginType_; }
68 const string& legalEntityId() const { return legalEntityId_; }
69 //@}
70
71 //! \name Utility
72 //@{
73 //! Check if the netting set details have been populated
74 bool empty() const { return nettingSetId_.empty(); }
75 bool emptyOptionalFields() const {
76 return agreementType_.empty() && callType_.empty() && initialMarginType_.empty() && legalEntityId_.empty();
77 }
78
79 //! Returns a map representation of the object
80 const map<string, string> mapRepresentation() const;
81
82 //! Returns the XML field names of all the private members
83 static const vector<string> fieldNames(bool includeOptionalFields = true);
84 static const vector<string> optionalFieldNames();
85 //@}
86
87private:
90 string callType_;
93};
94
95//! Comparison operators
96bool operator<(const NettingSetDetails& lhs, const NettingSetDetails& rhs);
97bool operator==(const NettingSetDetails& lhs, const NettingSetDetails& rhs);
98bool operator!=(const NettingSetDetails& lhs, const NettingSetDetails& rhs);
99
100//! Enable writing of netting set details
101std::ostream& operator<<(std::ostream& out, const NettingSetDetails& nettingSetDetails);
102
103} // namespace data
104} // namespace ore
Serializable object holding netting set identification data.
NettingSetDetails(const string &nettingSetId, const string &agreementType="", const string &callType="", const string &initialMarginType="", const string &legalEntityId="")
Constructor with all fields.
NettingSetDetails()
Default constructor.
bool empty() const
Check if the netting set details have been populated.
static const vector< string > optionalFieldNames()
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
const map< string, string > mapRepresentation() const
Returns a map representation of the object.
const string & initialMarginType() const
const string & nettingSetId() const
static const vector< string > fieldNames(bool includeOptionalFields=true)
Returns the XML field names of all the private members.
const string & callType() const
const string & legalEntityId() const
const string & agreementType() const
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
bool operator<(const Dividend &d1, const Dividend &d2)
bool operator!=(const Filter &a, const Filter &b)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
bool operator==(const Dividend &d1, const Dividend &d)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
XML utility functions.