Base PricingEngine Builder class for a specific model and engine. More...
#include <ored/portfolio/enginefactory.hpp>
Public Member Functions | |
EngineBuilder (const string &model, const string &engine, const set< string > &tradeTypes) | |
virtual | ~EngineBuilder () |
Virtual destructor. More... | |
const string & | model () const |
Return the model name. More... | |
const string & | engine () const |
Return the engine name. More... | |
const set< string > & | tradeTypes () const |
Return the possible trade types. More... | |
const string & | configuration (const MarketContext &key) |
Return a configuration (or the default one if key not found) More... | |
virtual void | reset () |
reset the builder (e.g. clear cache) More... | |
void | init (const QuantLib::ext::shared_ptr< Market > market, const map< MarketContext, string > &configurations, const map< string, string > &modelParameters, const map< string, string > &engineParameters, const std::map< std::string, std::string > &globalParameters={}) |
Initialise this Builder with the market and parameters to use. More... | |
const set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > & | modelBuilders () const |
return model builders More... | |
std::string | engineParameter (const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const |
std::string | modelParameter (const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const |
Protected Attributes | |
string | model_ |
string | engine_ |
set< string > | tradeTypes_ |
QuantLib::ext::shared_ptr< Market > | market_ |
map< MarketContext, string > | configurations_ |
map< string, string > | modelParameters_ |
map< string, string > | engineParameters_ |
std::map< std::string, std::string > | globalParameters_ |
set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > | modelBuilders_ |
Base PricingEngine Builder class for a specific model and engine.
The EngineBuilder is responsible for building pricing engines for a specific Model and Engine.
Each builder should implement a method with a signature
The exact parameters of each method can vary depending on the type of engine.
An EngineBuilder can cache engines and return the same PricingEngine multiple times, alternatively the Builder can build a unique PricingEngine each time it is called.
For example a swap engine builder can have the interface
and so returns the same (cached) engine every time it is asked for a particular currency.
The interface of each type of engine builder can be different, then there can be further sub-classes for different models and engines.
EngineBuilders are registered in an EngineFactory, multiple engine builders for the same trade type can be registered with the EngineFactory and it will select the appropriate one based on configuration.
Each EngineBuilder must return it's Model and Engine.
Definition at line 95 of file enginefactory.hpp.
EngineBuilder | ( | const string & | model, |
const string & | engine, | ||
const set< string > & | tradeTypes | ||
) |
Constructor that takes a model and engine name
model | the model name |
engine | the engine name |
tradeTypes | a set of trade types |
Definition at line 102 of file enginefactory.hpp.
|
virtual |
const string & model | ( | ) | const |
Return the model name.
Definition at line 109 of file enginefactory.hpp.
const string & engine | ( | ) | const |
Return the engine name.
Definition at line 111 of file enginefactory.hpp.
const set< string > & tradeTypes | ( | ) | const |
const string & configuration | ( | const MarketContext & | key | ) |
Return a configuration (or the default one if key not found)
Definition at line 116 of file enginefactory.hpp.
|
virtual |
reset the builder (e.g. clear cache)
Reimplemented in CachingEngineBuilder< T, U, Args >.
Definition at line 125 of file enginefactory.hpp.
void init | ( | const QuantLib::ext::shared_ptr< Market > | market, |
const map< MarketContext, string > & | configurations, | ||
const map< string, string > & | modelParameters, | ||
const map< string, string > & | engineParameters, | ||
const std::map< std::string, std::string > & | globalParameters = {} |
||
) |
Initialise this Builder with the market and parameters to use.
This method should not be called directly, it is called by the EngineFactory before it is returned.
Definition at line 131 of file enginefactory.hpp.
const set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > & modelBuilders | ( | ) | const |
return model builders
Definition at line 142 of file enginefactory.hpp.
std::string engineParameter | ( | const std::string & | p, |
const std::vector< std::string > & | qualifiers = {} , |
||
const bool | mandatory = true , |
||
const std::string & | defaultValue = "" |
||
) | const |
retrieve engine parameter p, first look for p_qualifier, if this does not exist fall back to p
Definition at line 55 of file enginefactory.cpp.
std::string modelParameter | ( | const std::string & | p, |
const std::vector< std::string > & | qualifiers = {} , |
||
const bool | mandatory = true , |
||
const std::string & | defaultValue = "" |
||
) | const |
retrieve model parameter p, first look for p_qualifier, if this does not exist fall back to p
Definition at line 60 of file enginefactory.cpp.
|
protected |
Definition at line 152 of file enginefactory.hpp.
|
protected |
Definition at line 153 of file enginefactory.hpp.
|
protected |
Definition at line 154 of file enginefactory.hpp.
|
protected |
Definition at line 155 of file enginefactory.hpp.
|
protected |
Definition at line 156 of file enginefactory.hpp.
|
protected |
Definition at line 157 of file enginefactory.hpp.
|
protected |
Definition at line 158 of file enginefactory.hpp.
|
protected |
Definition at line 159 of file enginefactory.hpp.
|
protected |
Definition at line 160 of file enginefactory.hpp.