Rechercher une page de manuel
QuantLib_LazyObject
Langue: en
Version: 374925 (fedora - 01/12/10)
Section: 3 (Bibliothèques de fonctions)
Sommaire
- NAME
- SYNOPSIS
- Detailed Description
- Member Function Documentation
- 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.
- 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.
- 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.
- Author
NAME
QuantLib::LazyObject -Framework for calculation on demand and result caching.
SYNOPSIS
#include <ql/patterns/lazyobject.hpp>
Inherits QuantLib::Observable, and QuantLib::Observer.
Inherited by AbcdAtmVolCurve, Basket, CapFloorTermVolCurve, CapFloorTermVolSurface, CmsMarket, EurodollarFuturesImpliedStdDevQuote, FdmBlackScholesSolver, FdmHestonHullWhiteSolver, FdmHestonSolver, FdmSimple2dBSSolver [private], 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 >, 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 const. Data members which will be calculated on demand need to be declared as mutable.
void recalculate ()
void freeze ()
void unfreeze ()
virtual void calculate () const
virtual void performCalculations () const =0
Detailed Description
Framework for calculation on demand and result caching.
Member Function Documentation
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 PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, AbcdAtmVolCurve, ForwardSwapQuote, PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, CapFloorTermVolSurface, StrippedOptionletAdapter, CmsMarket, FittedBondDiscountCurve, FlatForward, and PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >.
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.
Note:
- Explicit invocation of this method is not necessary if the object registered itself as observer with the structures on which such results depend. It is strongly advised to follow this policy when possible.
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.
Warning
- Objects cache the results of the previous calculation. Such results will be returned upon later invocations of calculate. When the results depend on arguments which could change between invocations, the lazy object must register itself as observer of such objects for the calculations to be performed again when they change.
Warning
- Should this method be redefined in derived classes, LazyObject::calculate() should be called in the overriding 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 EnergyBasisSwap, EnergyFuture, EnergyVanillaSwap, ConvertibleBond, RiskyBond, AbcdAtmVolCurve, Instrument, CompositeInstrument, FixedRateBondForward, Forward, Stock, EurodollarFuturesImpliedStdDevQuote, ForwardSwapQuote, ImpliedStdDevQuote, CapFloorTermVolSurface, OptionletStripper1, OptionletStripper2, and StrippedOptionletAdapter.
Author
Generated automatically by Doxygen for QuantLib from the source code.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre