AnalyticFactory.
More...
#include <orea/app/analytics/analyticfactory.hpp>
◆ getBuilders()
std::map< std::string, std::pair< std::set< std::string >, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > > getBuilders |
( |
| ) |
const |
Definition at line 28 of file analyticfactory.cpp.
28 {
29 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
31}
std::map< std::string, std::pair< std::set< std::string >, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > > builders_
boost::shared_mutex mutex_
◆ getBuilder()
std::pair< std::string, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > getBuilder |
( |
const std::string & |
analyticType | ) |
const |
Definition at line 34 of file analyticfactory.cpp.
34 {
35 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
36
39 return std::make_pair(b->first, b->second.second);
40
41
43 if (ba.second.first.size() > 0) {
44 auto sa = ba.second.first.find(analyticName);
45 if (sa != ba.second.first.end())
46 return std::make_pair(ba.first, ba.second.second);
47 }
48 }
49 WLOG(
"AnalyticFactory::getBuilder(" << analyticName <<
"): no builder found");
50 return std::make_pair(analyticName, nullptr);
51}
◆ addBuilder()
void addBuilder |
( |
const std::string & |
className, |
|
|
const std::set< std::string > & |
subAnalytics, |
|
|
const QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > & |
builder, |
|
|
const bool |
allowOverwrite = false |
|
) |
| |
Definition at line 53 of file analyticfactory.cpp.
54 {
55 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
56 QL_REQUIRE(
builders_.insert(std::make_pair(className, std::make_pair(subAnalytics, builder))).second ||
57 allowOverwrite,
58 "AnalyticFactory: duplicate builder for className '" << className << "'.");
59}
◆ build()
Build, throws for unknown className.
Definition at line 61 of file analyticfactory.cpp.
62 {
64 QuantLib::ext::shared_ptr<Analytic> a;
65 if (builder.second)
66 a = builder.second->build(inputs);
67 return std::make_pair(builder.first, a);
68}
std::pair< std::string, QuantLib::ext::shared_ptr< AbstractAnalyticBuilder > > getBuilder(const std::string &analyticType) const
◆ builders_
std::map<std::string, std::pair<std::set<std::string>, QuantLib::ext::shared_ptr<AbstractAnalyticBuilder> > > builders_ |
|
private |
◆ mutex_
boost::shared_mutex mutex_ |
|
mutableprivate |