21#include <ql/errors.hpp>
30 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
31 auto it =
map_.find(legType);
38 const bool allowOverwrite) {
39 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
40 QL_REQUIRE(
map_.insert(std::make_pair(legType, builder)).second || allowOverwrite,
41 "LegDataFactory::addBuilder(" << legType <<
"): builder for key already exists.");
QuantLib::ext::shared_ptr< LegAdditionalData > build(const std::string &legType)
void addBuilder(const std::string &legType, std::function< QuantLib::ext::shared_ptr< LegAdditionalData >()> builder, const bool allowOverwrite=false)
boost::shared_mutex mutex_
Leg data factory that can be used to build instances of leg data.
Serializable Credit Default Swap.