22#include <ql/errors.hpp>
32 std::pair<NettingSetDetails, QuantLib::ext::shared_ptr<NettingSetDefinition>> newNetSetDef(k, nettingSet);
34 bool added =
data_.insert(newNetSetDef).second;
38 QL_REQUIRE(
data_.size() ==
uniqueKeys_.size(),
"NettingSetManager: vector/map size mismatch");
42 return data_.find(nettingSetDetails) !=
data_.end();
59 for (
const auto& nsd :
data_) {
60 if (nsd.second->activeCsaFlag() && nsd.second->csaDetails()->calculateIMAmount())
68 for (
const auto& nsd :
data_) {
69 if (nsd.second->activeCsaFlag() && nsd.second->csaDetails()->calculateIMAmount()) {
77 if (
has(nettingSetDetails))
78 return data_.find(nettingSetDetails)->second;
80 QL_FAIL(
"NettingSetDefinition not found in manager: " << nettingSetDetails);
84 auto found = std::find_if(
data_.begin(),
data_.end(),
85 [&
id](
const auto& details) { return details.first.nettingSetId() == id; });
86 if (found !=
data_.end())
89 QL_FAIL(
"NettingSetDefinition not found in manager: " +
id);
95 for (
unsigned i = 0; i < nettingSetNodes.size(); i++) {
96 XMLNode* child = nettingSetNodes[i];
100 }
catch (std::exception& ex) {
111 for (
auto it =
data_.begin(); it !=
data_.end(); ++it)
void log() const
generate Boost log record to pass to corresponding sinks
Serializable object holding netting set identification data.
vector< NettingSetDetails > uniqueKeys_
map< NettingSetDetails, const QuantLib::ext::shared_ptr< NettingSetDefinition > > data_
const std::set< NettingSetDetails > calculateIMNettingSets() const
const bool calculateIMAmount() const
void add(const QuantLib::ext::shared_ptr< NettingSetDefinition > &nettingSet)
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
bool has(const string &id) const
QuantLib::ext::shared_ptr< NettingSetDefinition > get(const string &id) const
Utility classes for Structured warnings, contains the configuration type and ID (NettingSetId,...
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void checkNode(XMLNode *n, const string &expectedName)
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
static void appendNode(XMLNode *parent, XMLNode *child)
Classes and functions for log message handling.
Serializable Credit Default Swap.
Manager class for repository of netting set details.
Class for structured configuration warnings.