29 : instrumentType_(instrumentType) {}
38 : instruments_(instruments) {
42 string instType = instrument->instrumentType();
46 QL_REQUIRE(
instrumentType_ == instType,
"All instruments in CalibrationBasket should have the same " <<
47 "instrument type. Have " <<
instrumentType_ <<
" but current instrument is " << instType <<
".");
67 QL_REQUIRE(
empty(),
"The calibration basket should be empty before calling fromXML.");
79 "the same instrument type. Have " <<
instrumentType_ <<
" but current node is " <<
name <<
".");
83 auto instrument = CalibrationInstrumentFactory::instance().build(
instrumentType_);
84 QL_REQUIRE(instrument,
"Calibration instrument type " <<
instrumentType_ <<
85 " has not been registered with the calibration instrument factory.");
86 instrument->fromXML(cn);
92 QL_REQUIRE(!
empty(),
"The calibration basket should have at least one calibration instrument.");
class for holding details of the calibration instruments for a model
factory for making calibration instruments.
CalibrationBasket()
Default constructor, empty calibration basket.
std::string parameter_
The parameter tag may be given so that builders know how to use the calibration basket.
std::vector< QuantLib::ext::shared_ptr< CalibrationInstrument > > instruments_
std::string instrumentType_
const std::string & parameter() const
bool empty() const
Returns true if the calibration basket is empty.
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
const std::string & instrumentType() const
const std::vector< QuantLib::ext::shared_ptr< CalibrationInstrument > > & instruments() const
CalibrationInstrument(const std::string &instrumentType)
Constructor.
std::string instrumentType_
const std::string & instrumentType() const
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addAttribute(XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
static string getAttribute(XMLNode *node, const string &attrName)
static void checkNode(XMLNode *n, const string &expectedName)
static string getNodeName(XMLNode *n)
Get and set a node's name.
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
static void appendNode(XMLNode *parent, XMLNode *child)
Serializable Credit Default Swap.