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. | |
const string & | model () const |
Return the model name. | |
const string & | engine () const |
Return the engine name. | |
const set< string > & | tradeTypes () const |
Return the possible trade types. | |
const string & | configuration (const MarketContext &key) |
Return a configuration (or the default one if key not found) | |
virtual void | reset () |
reset the builder (e.g. clear cache) | |
void | init (const boost::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, boost::shared_ptr< QuantExt::ModelBuilder > > > & | modelBuilders () const |
return model builders | |
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_ |
boost::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, boost::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.
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 |
void init | ( | const boost::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.
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
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