QuantLib
A free/open-source library for quantitative finance
Reference manual - version 1.20
Public Types | Public Member Functions | List of all members
Observer Class Referenceabstract

Object that gets notified when a given observable changes. More...

#include <ql/patterns/observable.hpp>

+ Inheritance diagram for Observer:

Public Types

typedef boost::unordered_set< ext::shared_ptr< Observable > > set_type
 
typedef set_type::iterator iterator
 

Public Member Functions

 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
std::pair< iterator, bool > registerWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Detailed Description

Object that gets notified when a given observable changes.

Member Function Documentation

◆ registerWithObservables()

void registerWithObservables ( const ext::shared_ptr< Observer > &  o)

register with all observables of a given observer. Note that this does not include registering with the observer itself.

◆ update()

virtual void update ( )
pure 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.

Implemented in YieldTermStructure, ZeroSpreadedTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >, ForwardSpreadedTermStructure, FlatForward, FittedBondDiscountCurve, CmsMarket, SmileSection, StrippedOptionletAdapter, CapFloorTermVolSurface, CapFloorTermVolCurve, PiecewiseZeroInflationCurve< Interpolator, Bootstrap, Traits >, PiecewiseYoYInflationCurve< Interpolator, Bootstrap, Traits >, DefaultProbabilityTermStructure, PiecewiseDefaultCurve< Traits, Interpolator, Bootstrap >, CdsHelper, RelativeDateBootstrapHelper< TS >, BootstrapHelper< TS >, BootstrapHelper< YoYInflationTermStructure >, BootstrapHelper< ZeroInflationTermStructure >, BootstrapHelper< YoYOptionletVolatilitySurface >, TermStructure, StochasticProcess, LastFixingQuote, FuturesConvAdjustmentQuote, ForwardValueQuote, ForwardSwapQuote, DerivedQuote< UnaryFunction >, CompositeQuote< BinaryFunction >, HybridHestonHullWhiteProcess, GeneralizedBlackScholesProcess, FdHestonHullWhiteVanillaEngine, COSHestonEngine, AnalyticHestonHullWhiteEngine, LatticeShortRateModelEngine< Arguments, Results >, LatticeShortRateModelEngine< CapFloor::arguments, CapFloor::results >, LatticeShortRateModelEngine< VanillaSwap::arguments, VanillaSwap::results >, LatticeShortRateModelEngine< Swaption::arguments, Swaption::results >, LatticeShortRateModelEngine< CallableBond::arguments, CallableBond::results >, GenericEngine< ArgumentsType, ResultsType >, GenericEngine< EnergyCommodity::arguments, EnergyCommodity::results >, GenericEngine< HolderExtensibleOption::arguments, HolderExtensibleOption::results >, GenericEngine< YearOnYearInflationSwap::arguments, YearOnYearInflationSwap::results >, GenericEngine< ForwardOptionArguments< VanillaOption::arguments >, VanillaOption::results >, GenericEngine< CPISwap::arguments, CPISwap::results >, GenericEngine< VarianceSwap::arguments, VarianceSwap::results >, GenericEngine< VanillaSwingOption::arguments, VanillaSwingOption::results >, GenericEngine< PagodaOption::arguments, PagodaOption::results >, GenericEngine< MargrabeOption::arguments, MargrabeOption::results >, GenericEngine< Arguments, Results >, GenericEngine< CreditDefaultSwap::arguments, CreditDefaultSwap::results >, GenericEngine< ContinuousFixedLookbackOption::arguments, ContinuousFixedLookbackOption::results >, GenericEngine< CapFloor::arguments, CapFloor::results >, GenericEngine< IrregularSwap::arguments, IrregularSwap::results >, GenericEngine< IrregularSwaption::arguments, IrregularSwaption::results >, GenericEngine< ContinuousPartialFloatingLookbackOption::arguments, ContinuousPartialFloatingLookbackOption::results >, GenericEngine< NonstandardSwap::arguments, NonstandardSwap::results >, GenericEngine< VanillaStorageOption::arguments, VanillaStorageOption::results >, GenericEngine< TwoAssetCorrelationOption::arguments, TwoAssetCorrelationOption::results >, GenericEngine< EverestOption::arguments, EverestOption::results >, GenericEngine< HimalayaOption::arguments, HimalayaOption::results >, GenericEngine< SpreadOption::arguments, SpreadOption::results >, GenericEngine< MultiAssetOption::arguments, MultiAssetOption::results >, GenericEngine< SyntheticCDO::arguments, SyntheticCDO::results >, GenericEngine< CdsOption::arguments, CdsOption::results >, GenericEngine< CompoundOption::arguments, CompoundOption::results >, GenericEngine< NthToDefault::arguments, NthToDefault::results >, GenericEngine< CliquetOption::arguments, CliquetOption::results >, GenericEngine< FloatFloatSwaption::arguments, FloatFloatSwaption::results >, GenericEngine< ContinuousFloatingLookbackOption::arguments, ContinuousFloatingLookbackOption::results >, GenericEngine< PartialTimeBarrierOption::arguments, PartialTimeBarrierOption::results >, GenericEngine< OneAssetOption::arguments, OneAssetOption::results >, GenericEngine< DividendBarrierOption::arguments, DividendBarrierOption::results >, GenericEngine< ComplexChooserOption::arguments, ComplexChooserOption::results >, GenericEngine< ContinuousAveragingAsianOption::arguments, ContinuousAveragingAsianOption::results >, GenericEngine< PathMultiAssetOption::arguments, PathMultiAssetOption::results >, GenericEngine< VanillaSwap::arguments, VanillaSwap::results >, GenericEngine< BarrierOption::arguments, BarrierOption::results >, GenericEngine< VarianceOption::arguments, VarianceOption::results >, GenericEngine< CatBond::arguments, CatBond::results >, GenericEngine< ContinuousPartialFixedLookbackOption::arguments, ContinuousPartialFixedLookbackOption::results >, GenericEngine< VanillaVPPOption::arguments, VanillaVPPOption::results >, GenericEngine< FloatFloatSwap::arguments, FloatFloatSwap::results >, GenericEngine< ConvertibleBond::option::arguments, ConvertibleBond::option::results >, GenericEngine< Swaption::arguments, Swaption::results >, GenericEngine< YoYInflationCapFloor::arguments, YoYInflationCapFloor::results >, GenericEngine< CallableBond::arguments, CallableBond::results >, GenericEngine< WriterExtensibleOption::arguments, WriterExtensibleOption::results >, GenericEngine< DiscreteAveragingAsianOption::arguments, DiscreteAveragingAsianOption::results >, GenericEngine< VanillaOption::arguments, VanillaOption::results >, GenericEngine< TwoAssetBarrierOption::arguments, TwoAssetBarrierOption::results >, GenericEngine< Swap::arguments, Swap::results >, GenericEngine< NonstandardSwaption::arguments, NonstandardSwaption::results >, GenericEngine< Bond::arguments, Bond::results >, GenericEngine< ZeroCouponInflationSwap::arguments, ZeroCouponInflationSwap::results >, GenericEngine< Instr::arguments, QuantoOptionResults< Instr::results > >, GenericEngine< DividendVanillaOption::arguments, DividendVanillaOption::results >, GenericEngine< BasketOption::arguments, BasketOption::results >, GenericEngine< CPICapFloor::arguments, CPICapFloor::results >, GenericEngine< DoubleBarrierOption::arguments, DoubleBarrierOption::results >, GenericEngine< SimpleChooserOption::arguments, SimpleChooserOption::results >, LazyObject, MarkovFunctional, Gsr, CalibratedModel, Claim, InterestRateIndex, InflationIndex, SabrVolSurface, ExtendedBlackVarianceSurface, ExtendedBlackVarianceCurve, AbcdAtmVolCurve, LatentModel< copulaPolicyImpl >, LatentModel< GaussianCopulaPolicy >, LatentModel< copulaPolicy >, PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, DeltaVolQuote, ConstantRecoveryModel, RandomDefaultModel, RandomLM< derivedRandomLM, copulaPolicy, USNG >, GaussianLHPLossModel, DefaultLatentModel< copulaPolicy >, Basket, BaseCorrelationTermStructure< Interpolator2D_T >, CommodityIndex, InflationCouponPricer, InflationCoupon, IndexedCashFlow, FloatingRateCoupon, DigitalCoupon, FloatingRateCouponPricer, CappedFlooredYoYInflationCoupon, and CappedFlooredCoupon.

◆ deepUpdate()

void deepUpdate ( )
virtual

This method allows to explicitly update the instance itself and nested observers. If notifications are disabled a call to this method ensures an update of such nested observers. It should be implemented in derived classes whenever applicable

Reimplemented in StrippedOptionletAdapter, Swap, CompositeInstrument, CapFloor, and Bond.