28#include <ql/time/date.hpp>
29#include <ql/types.hpp>
46 QuantLib::Size
numDates()
const override {
return 1; }
49 QuantLib::Size
depth()
const override {
return 1; }
52 Real
get(QuantLib::Size
id, QuantLib::Size sample)
const {
return this->
get(
id, 0, sample, 0); }
55 Real
get(
const std::string&
id, QuantLib::Size sample)
const {
return this->
get(
id,
asof(), sample, 0); };
58 void set(QuantLib::Real value, QuantLib::Size
id, QuantLib::Size sample) { this->
set(value,
id, 0, sample, 0); }
61 void set(QuantLib::Real value,
const std::string&
id, QuantLib::Size sample) {
71 virtual std::map<QuantLib::Size, QuantLib::Real>
getTradeNPVs(Size tradeIdx)
const = 0;
76 std::map<QuantLib::Size, QuantLib::Real>
getTradeNPVs(
const std::string& tradeId)
const {
NPV Cube class stores both future and current NPV values.
virtual Real get(Size id, Size date, Size sample, Size depth=0) const =0
Get a value from the cube using index.
virtual QuantLib::Date asof() const =0
Return the asof date (T0 date)
virtual void set(Real value, Size id, Size date, Size sample, Size depth=0)=0
Set a value in the cube using index.
virtual Size index(const std::string &id) const
NPVSensiCube class stores NPVs resulting from risk factor shifts on an as of date.
Size getTradeIndex(const std::string &tradeId) const
Return the index of the trade in the cube.
QuantLib::Size depth() const override
The depth in the NPVSensiCube is exactly one.
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs(const std::string &tradeId) const
virtual std::set< QuantLib::Size > relevantScenarios() const =0
void set(QuantLib::Real value, const std::string &id, QuantLib::Size sample)
Convenience method to set a value in the cube using id and sample only.
Real get(const std::string &id, QuantLib::Size sample) const
Convenience method to get a value from the cube using id and sample only.
void set(QuantLib::Real value, QuantLib::Size id, QuantLib::Size sample)
Convenience method to set a value in the cube using id and sample only.
Real get(QuantLib::Size id, QuantLib::Size sample) const
Convenience method to get a value from the cube using id and sample only.
virtual std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs(Size tradeIdx) const =0
QuantLib::Size numDates() const override
Number of dates in the NPVSensiCube is exactly one i.e. the as of date.
SafeStack< ValueType > value