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_nothing_hpp
22 #define quantlib_multistep_nothing_hpp
23 
24 #include <ql/models/marketmodels/products/multiproductmultistep.hpp>
25 
26 namespace QuantLib {
27 
28     class MultiStepNothing : public MultiProductMultiStep {
29       public:
30         MultiStepNothing(const EvolutionDescription& evolution,
31                          Size numberOfProducts = 1,
32                          Size doneIndex = 0);
33         //! \name MarketModelMultiProduct interface
34         //@{
35         std::vector<Time> possibleCashFlowTimes() const;
36         Size numberOfProducts() const;
37         Size maxNumberOfCashFlowsPerProductPerStep() const;
38         void reset();
39         bool nextTimeStep(const CurveState&,
40                           std::vector<Size>&,
41                           std::vector<std::vector<CashFlow> >&);
42         #if defined(QL_USE_STD_UNIQUE_PTR)
43         std::unique_ptr<MarketModelMultiProduct> clone() const;
44         #else
45         std::auto_ptr<MarketModelMultiProduct> clone() const;
46         #endif
47         //@}
48       private:
49         Size numberOfProducts_, doneIndex_;
50         // things that vary in a path
51         Size currentIndex_;
52     };
53 
54     // inline definitions
55 
56     inline std::vector<Time>
possibleCashFlowTimes() const57     MultiStepNothing::possibleCashFlowTimes() const {
58         return std::vector<Time>();
59     }
60 
numberOfProducts() const61     inline Size MultiStepNothing::numberOfProducts() const {
62         return numberOfProducts_;
63     }
64 
65     inline Size
maxNumberOfCashFlowsPerProductPerStep() const66     MultiStepNothing::maxNumberOfCashFlowsPerProductPerStep() const {
67         return 0;
68     }
69 
reset()70     inline void MultiStepNothing::reset() {
71        currentIndex_=0;
72     }
73 
74 }
75 
76 #endif
77