22#include <ql/errors.hpp>
30 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
35 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
37 QL_REQUIRE(b !=
builders_.end(),
"TradeFactory::getBuilder(" << className <<
"): no builder found");
42 const bool allowOverwrite) {
43 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
44 QL_REQUIRE(
builders_.insert(std::make_pair(className, builder)).second || allowOverwrite,
45 "TradeFactory: duplicate builder for className '" << className <<
"'.");
void addBuilder(const std::string &tradeType, const QuantLib::ext::shared_ptr< AbstractTradeBuilder > &builder, const bool allowOverwrite=false)
std::map< std::string, QuantLib::ext::shared_ptr< AbstractTradeBuilder > > builders_
boost::shared_mutex mutex_
QuantLib::ext::shared_ptr< AbstractTradeBuilder > getBuilder(const std::string &tradeType) const
QuantLib::ext::shared_ptr< Trade > build(const std::string &className) const
Build, throws for unknown className.
std::map< std::string, QuantLib::ext::shared_ptr< AbstractTradeBuilder > > getBuilders() const
Serializable Credit Default Swap.