27#include <ql/patterns/singleton.hpp>
29#include <boost/make_shared.hpp>
30#include <boost/thread/lock_types.hpp>
31#include <boost/thread/shared_mutex.hpp>
49 virtual QuantLib::ext::shared_ptr<Analytic>
50 build(
const QuantLib::ext::shared_ptr<ore::analytics::InputParameters>& inputs)
const = 0;
59 virtual QuantLib::ext::shared_ptr<Analytic>
60 build(
const QuantLib::ext::shared_ptr<ore::analytics::InputParameters>& inputs)
const override {
61 return QuantLib::ext::make_shared<T>(inputs);
69class AnalyticFactory :
public QuantLib::Singleton<AnalyticFactory, std::integral_constant<bool, true>> {
70 std::map<std::string, std::pair<std::set<std::string>, QuantLib::ext::shared_ptr<AbstractAnalyticBuilder>>>
76 std::pair<std::set<std::string>, QuantLib::ext::shared_ptr<AbstractAnalyticBuilder>>>
getBuilders()
const;
77 std::pair < std::string,
78 QuantLib::ext::shared_ptr<AbstractAnalyticBuilder>>
getBuilder(
const std::string& analyticType)
const;
79 void addBuilder(
const std::string& className,
const std::set<std::string>& subAnalytics,
80 const QuantLib::ext::shared_ptr<AbstractAnalyticBuilder>& builder,
81 const bool allowOverwrite =
false);
84 std::pair<std::string, QuantLib::ext::shared_ptr<Analytic>>
build(
const std::string& subAnalytic,
85 const QuantLib::ext::shared_ptr<ore::analytics::InputParameters>& inputs)
const;
virtual QuantLib::ext::shared_ptr< Analytic > build(const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > &inputs) const =0
virtual ~AbstractAnalyticBuilder()
Template AnalyticBuilder class.
virtual QuantLib::ext::shared_ptr< Analytic > build(const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > &inputs) const override
std::pair< std::string, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > getBuilder(const std::string &analyticType) const
std::map< std::string, std::pair< std::set< std::string >, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > > getBuilders() const
void addBuilder(const std::string &className, const std::set< std::string > &subAnalytics, const QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > &builder, const bool allowOverwrite=false)
std::map< std::string, std::pair< std::set< std::string >, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > > builders_
boost::shared_mutex mutex_
std::pair< std::string, QuantLib::ext::shared_ptr< Analytic > > build(const std::string &subAnalytic, const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > &inputs) const
Build, throws for unknown className.