QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
exerciseadapter.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Mark Joshi
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20
21#ifndef quantlib_multistep_exercise_adapter_hpp
22#define quantlib_multistep_exercise_adapter_hpp
23
27
28namespace QuantLib {
29
31 public:
34 //! \name MarketModelMultiProduct interface
35 //@{
36 std::vector<Time> possibleCashFlowTimes() const override;
37 Size numberOfProducts() const override;
38 const EvolutionDescription& evolution() const override;
40 void reset() override;
41 bool nextTimeStep(const CurveState&,
42 std::vector<Size>&,
43 std::vector<std::vector<CashFlow> >&) override;
44 std::unique_ptr<MarketModelMultiProduct> clone() const override;
45 //@}
46 //! \name inspectors
47 //@{
49 //@}
50 private:
53 std::valarray<bool> isExerciseTime_;
55 };
56
57 // inline definition
58
59 inline std::vector<Time>
61 return exercise_->possibleCashFlowTimes();
62 }
63
65 return numberOfProducts_;
66 }
67
69 return exercise_->evolution();
70 }
71
72 inline Size
74 return 1;
75 }
76
77 inline void ExerciseAdapter::reset() {
78 exercise_->reset();
79 currentIndex_ = 0;
80 }
81
82 inline const MarketModelExerciseValue&
84 return *exercise_;
85 }
86
87}
88
89#endif
cloning proxy to an underlying object
Definition: clone.hpp:40
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
std::unique_ptr< MarketModelMultiProduct > clone() const override
returns a newly-allocated copy of itself
bool nextTimeStep(const CurveState &, std::vector< Size > &, std::vector< std::vector< CashFlow > > &) override
return value indicates whether path is finished, TRUE means done
const MarketModelExerciseValue & exerciseValue() const
Clone< MarketModelExerciseValue > exercise_
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
Size maxNumberOfCashFlowsPerProductPerStep() const override
std::valarray< bool > isExerciseTime_
Size numberOfProducts() const override
void reset() override
during simulation put product at start of path
Multiple-step market-model product.
cloning proxy to an underlying object
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35