28#include <ql/patterns/singleton.hpp>
30#include <boost/thread/shared_mutex.hpp>
31#include <boost/thread/lock_types.hpp>
41 virtual QuantLib::ext::shared_ptr<ReferenceDatum>
build()
const = 0;
50 virtual QuantLib::ext::shared_ptr<ReferenceDatum>
build()
const override {
return QuantLib::ext::make_shared<T>(); }
53class ReferenceDatumFactory :
public QuantLib::Singleton<ReferenceDatumFactory, std::integral_constant<bool, true>> {
58 typedef std::map<std::string, std::function<QuantLib::ext::shared_ptr<AbstractReferenceDatumBuilder>()>>
map_type;
60 QuantLib::ext::shared_ptr<ReferenceDatum>
build(const std::string& refDatumType);
62 void
addBuilder(const std::string& refDatumType,
63 std::function<QuantLib::ext::shared_ptr<AbstractReferenceDatumBuilder>()> builder,
64 const bool allowOverwrite = false);
72 return QuantLib::ext::make_shared<T>();
virtual ~AbstractReferenceDatumBuilder()
virtual QuantLib::ext::shared_ptr< ReferenceDatum > build() const =0
Template TradeBuilder class.
virtual QuantLib::ext::shared_ptr< ReferenceDatum > build() const override
QuantLib::ext::shared_ptr< ReferenceDatum > build(const std::string &refDatumType)
void addBuilder(const std::string &refDatumType, std::function< QuantLib::ext::shared_ptr< AbstractReferenceDatumBuilder >()> builder, const bool allowOverwrite=false)
std::map< std::string, std::function< QuantLib::ext::shared_ptr< AbstractReferenceDatumBuilder >()> > map_type
boost::shared_mutex mutex_
QuantLib::ext::shared_ptr< AbstractReferenceDatumBuilder > createReferenceDatumBuilder()
Serializable Credit Default Swap.