Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CloneScenarioFactory Class Reference

Factory class for cloning scenario objects. More...

#include <orea/scenario/clonescenariofactory.hpp>

+ Inheritance diagram for CloneScenarioFactory:
+ Collaboration diagram for CloneScenarioFactory:

Public Member Functions

 CloneScenarioFactory (const QuantLib::ext::shared_ptr< Scenario > &baseScenario)
 Constructor. More...
 
const QuantLib::ext::shared_ptr< ScenariobuildScenario (Date asof, bool isAbsolute, const std::string &label="", Real numeraire=0.0) const override
 returns a new scenario, using the base scenario as a starting point More...
 
- Public Member Functions inherited from ScenarioFactory
virtual ~ScenarioFactory ()
 Default destructor. More...
 
virtual const QuantLib::ext::shared_ptr< ScenariobuildScenario (Date asof, bool isAbsolute, const std::string &label="", Real numeraire=0.0) const =0
 Build a scenario instance without filling it. More...
 

Private Attributes

QuantLib::ext::shared_ptr< ScenariobaseScenario_
 

Detailed Description

Factory class for cloning scenario objects.

Definition at line 34 of file clonescenariofactory.hpp.

Constructor & Destructor Documentation

◆ CloneScenarioFactory()

CloneScenarioFactory ( const QuantLib::ext::shared_ptr< Scenario > &  baseScenario)

Constructor.

Definition at line 26 of file clonescenariofactory.cpp.

27 : baseScenario_(baseScenario) {
28 QL_REQUIRE(baseScenario_ != NULL, "base scenario pointer must not be NULL");
29}
QuantLib::ext::shared_ptr< Scenario > baseScenario_

Member Function Documentation

◆ buildScenario()

const QuantLib::ext::shared_ptr< Scenario > buildScenario ( Date  asof,
bool  isAbsolute,
const std::string &  label = "",
Real  numeraire = 0.0 
) const
overridevirtual

returns a new scenario, using the base scenario as a starting point

Implements ScenarioFactory.

Definition at line 32 of file clonescenariofactory.cpp.

32 {
33 QuantLib::ext::shared_ptr<Scenario> newScen = baseScenario_->clone();
34 QL_REQUIRE(asof == newScen->asof(),
35 "unexpected asof date (" << asof << "), does not match base - " << baseScenario_->asof());
36 newScen->label(label);
37 QL_REQUIRE((label == newScen->label()) || (label == ""), "CloneScenarioFactory has not updated scenario label");
38 if (numeraire != 0.0)
39 newScen->setNumeraire(numeraire);
40 newScen->setAbsolute(isAbsolute);
41 return newScen;
42}
Date asof(14, Jun, 2018)
+ Here is the call graph for this function:

Member Data Documentation

◆ baseScenario_

QuantLib::ext::shared_ptr<Scenario> baseScenario_
private

Definition at line 43 of file clonescenariofactory.hpp.