26#include <ql/errors.hpp>
27#include <ql/types.hpp>
28#include <ql/patterns/observable.hpp>
77 const string& qualifier =
"")
const = 0;
80 const string& qualifier =
"") = 0;
83 virtual std::vector<std::pair<AggregationScenarioDataType, std::string>>
keys()
const = 0;
115 return data_.find(std::make_pair(type, qualifier)) !=
data_.end();
121 const string& qualifier =
"")
const override {
122 check(dateIndex, sampleIndex, type, qualifier);
123 return data_.at(std::make_pair(type, qualifier))[dateIndex][sampleIndex];
126 std::vector<std::pair<AggregationScenarioDataType, std::string>>
keys()
const override {
127 std::vector<std::pair<AggregationScenarioDataType, std::string>> res;
128 for (
auto const& k :
data_)
129 res.push_back(k.first);
134 const string& qualifier =
"")
override {
135 check(dateIndex, sampleIndex, type, qualifier);
136 auto key = std::make_pair(type, qualifier);
137 auto it =
data_.find(key);
138 if (it ==
data_.end()) {
146 const string& qualifier)
const {
147 QL_REQUIRE(dateIndex <
dimDates_,
"dateIndex (" << dateIndex <<
") out of range 0..." <<
dimDates_ - 1);
149 "sampleIndex (" << sampleIndex <<
") out of range 0..." <<
dimSamples_ - 1);
153 map<std::pair<AggregationScenarioDataType, string>, vector<vector<Real>>>
data_;
159 return out <<
"IndexFixing";
161 return out <<
"FXSpot";
163 return out <<
"Numeraire";
165 return out <<
"CreditState";
167 return out <<
"SurvivalWeight";
169 return out <<
"RecoveryRate";
171 return out <<
"Generic";
173 return out <<
"Unknown aggregation scenario data type";
Container for storing simulated market data.
virtual void set(Real value, const AggregationScenarioDataType &type, const string &qualifier="")
Set a value in the cube, assumes normal traversal of the cube (dates then samples)
virtual Real get(Size dateIndex, Size sampleIndex, const AggregationScenarioDataType &type, const string &qualifier="") const =0
Get a value from the cube.
virtual Size dimDates() const =0
Return the length of each dimension.
virtual void next()
Go to the next point on the cube.
AggregationScenarioData & operator=(AggregationScenarioData const &)=delete
virtual Size dimSamples() const =0
virtual bool has(const AggregationScenarioDataType &type, const string &qualifier="") const =0
Check whether data is available for the given type.
AggregationScenarioData(AggregationScenarioData &)=delete
Do not allow copying.
virtual std::vector< std::pair< AggregationScenarioDataType, std::string > > keys() const =0
virtual ~AggregationScenarioData()
dtor
virtual void set(Size dateIndex, Size sampleIndex, Real value, const AggregationScenarioDataType &type, const string &qualifier="")=0
Set a value in the cube.
AggregationScenarioData()
default ctor
A concrete in memory implementation of AggregationScenarioData.
InMemoryAggregationScenarioData(Size dimDates, Size dimSamples)
InMemoryAggregationScenarioData()
Size dimDates() const override
Return the length of each dimension.
void set(Size dateIndex, Size sampleIndex, Real value, const AggregationScenarioDataType &type, const string &qualifier="") override
Set a value in the cube.
map< std::pair< AggregationScenarioDataType, string >, vector< vector< Real > > > data_
Size dimSamples() const override
std::vector< std::pair< AggregationScenarioDataType, std::string > > keys() const override
Real get(Size dateIndex, Size sampleIndex, const AggregationScenarioDataType &type, const string &qualifier="") const override
void check(Size dateIndex, Size sampleIndex, const AggregationScenarioDataType &type, const string &qualifier) const
bool has(const AggregationScenarioDataType &type, const string &qualifier="") const override
Check whether data is available for the given type.
SafeStack< ValueType > value
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
AggregationScenarioDataType