- QuantLib
- LazyObject
Framework for calculation on demand and result caching. More...
#include <ql/patterns/lazyobject.hpp>
Inherits Observable, and Observer.
Inherited by AbcdAtmVolCurve, Basket, CapFloorTermVolCurve, CapFloorTermVolSurface, CmsMarket, EurodollarFuturesImpliedStdDevQuote, Fdm2dBlackScholesSolver, Fdm2DimSolver, Fdm3DimSolver, FdmBatesSolver, FdmBlackScholesSolver, FdmExtOUJumpSolver, FdmHestonHullWhiteSolver, FdmHestonSolver, FdmKlugeExtOUSolver< N >, FdmNdimSolver< N >, FdmSimple2dBSSolver [private]
, FdmSimple2dExtOUSolver, FdmSimple3dExtOUJumpSolver, FittedBondDiscountCurve, FlatForward, ForwardSwapQuote, ImpliedStdDevQuote, Instrument, InterpolatedSmileSection< Interpolator >, OneFactorCopula, PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >, PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, RendistatoCalculator [private]
, SabrInterpolatedSmileSection, StrippedOptionletAdapter, StrippedOptionletBase, and SwaptionVolatilityDiscrete.
Public Member Functions | |
Observer interface | |
void | update () |
Protected Attributes | |
bool | calculated_ |
bool | frozen_ |
Calculations | |
These methods do not modify the structure of the object and are therefore declared as | |
void | recalculate () |
void | freeze () |
void | unfreeze () |
virtual void | calculate () const |
virtual void | performCalculations () const =0 |
Framework for calculation on demand and result caching.
void update | ( | ) | [virtual] |
This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.
Implements Observer.
Reimplemented in PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >, PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >, FittedBondDiscountCurve, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, CapFloorTermVolCurve, CapFloorTermVolSurface, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, FlatForward, AbcdAtmVolCurve, StrippedOptionletAdapter, CmsMarket, and ForwardSwapQuote.
void recalculate | ( | ) |
This method force the recalculation of any results which would otherwise be cached. It is not declared as const
since it needs to call the non-const
notifyObservers method.
void freeze | ( | ) |
This method constrains the object to return the presently cached results on successive invocations, even if arguments upon which they depend should change.
void unfreeze | ( | ) |
This method reverts the effect of the freeze method, thus re-enabling recalculations.
void calculate | ( | ) | const [protected, virtual] |
This method performs all needed calculations by calling the performCalculations method.
Reimplemented in Instrument.
virtual void performCalculations | ( | ) | const [protected, pure virtual] |
This method must implement any calculations which must be (re)done in order to calculate the desired results.
Implemented in FixedRateBondForward, Forward, Instrument, SwaptionVolatilityMatrix, CapFloorTermVolCurve, CapFloorTermVolSurface, RiskyBond, AbcdAtmVolCurve, ConvertibleBond, CompositeInstrument, EnergyVanillaSwap, EnergyBasisSwap, OptionletStripper1, OptionletStripper2, StrippedOptionletAdapter, ForwardSwapQuote, EurodollarFuturesImpliedStdDevQuote, ImpliedStdDevQuote, EnergyFuture, and Stock.