QuantLib
A free/open-source library for quantitative finance
Fully annotated sources - version 1.22
Public Types | Public Member Functions | Private Attributes | 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:
+ Collaboration diagram for Observer:

Public Types

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

Public Member Functions

 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (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 ()
 

Private Attributes

set_type observables_
 

Detailed Description

Object that gets notified when a given observable changes.

Definition at line 101 of file observable.hpp.

Member Typedef Documentation

◆ set_type

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

Definition at line 103 of file observable.hpp.

◆ iterator

typedef set_type::iterator iterator

Definition at line 104 of file observable.hpp.

Constructor & Destructor Documentation

◆ Observer() [1/2]

Observer ( )
default

◆ Observer() [2/2]

Observer ( const Observer o)

Definition at line 189 of file observable.hpp.

◆ ~Observer()

~Observer ( )
virtual

Definition at line 205 of file observable.hpp.

Member Function Documentation

◆ operator=()

Observer & operator= ( const Observer o)

Definition at line 195 of file observable.hpp.

◆ registerWith()

std::pair< Observer::iterator, bool > registerWith ( const ext::shared_ptr< Observable > &  h)

Definition at line 211 of file observable.hpp.

+ Here is the caller graph for this function:

◆ 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.

Definition at line 220 of file observable.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unregisterWith()

Size unregisterWith ( const ext::shared_ptr< Observable > &  h)

Definition at line 229 of file observable.hpp.

+ Here is the caller graph for this function:

◆ unregisterWithAll()

void unregisterWithAll ( )

Definition at line 235 of file observable.hpp.

◆ 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, UltimateForwardTermStructure, InterpolatedPiecewiseZeroSpreadedTermStructure< Interpolator >, PiecewiseYieldCurve< Traits, Interpolator, Bootstrap >, ForwardSpreadedTermStructure, FlatForward, FittedBondDiscountCurve, CompositeZeroYieldStructure< BinaryFunction >, SwaptionVolatilityDiscrete, SwaptionVolCube1x< Model >::PrivateObserver, CmsMarket, SpreadedSmileSection, SmileSection, SabrInterpolatedSmileSection, StrippedOptionletAdapter, InterpolatedSmileSection< Interpolator >, GridModelLocalVolSurface, 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 >, JointStochasticProcess, HybridHestonHullWhiteProcess, GeneralizedBlackScholesProcess, FdHestonVanillaEngine, 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< YearOnYearInflationSwap::arguments, YearOnYearInflationSwap::results >, GenericEngine< EnergyCommodity::arguments, EnergyCommodity::results >, GenericEngine< HolderExtensibleOption::arguments, HolderExtensibleOption::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< Arguments, Results >, GenericEngine< MargrabeOption::arguments, MargrabeOption::results >, GenericEngine< ContinuousFixedLookbackOption::arguments, ContinuousFixedLookbackOption::results >, GenericEngine< CapFloor::arguments, CapFloor::results >, GenericEngine< CreditDefaultSwap::arguments, CreditDefaultSwap::results >, GenericEngine< NonstandardSwap::arguments, NonstandardSwap::results >, GenericEngine< IrregularSwap::arguments, IrregularSwap::results >, GenericEngine< ContinuousPartialFloatingLookbackOption::arguments, ContinuousPartialFloatingLookbackOption::results >, GenericEngine< VanillaStorageOption::arguments, VanillaStorageOption::results >, GenericEngine< IrregularSwaption::arguments, IrregularSwaption::results >, GenericEngine< MultiAssetOption::arguments, MultiAssetOption::results >, GenericEngine< TwoAssetCorrelationOption::arguments, TwoAssetCorrelationOption::results >, GenericEngine< EverestOption::arguments, EverestOption::results >, GenericEngine< SpreadOption::arguments, SpreadOption::results >, GenericEngine< HimalayaOption::arguments, HimalayaOption::results >, GenericEngine< SyntheticCDO::arguments, SyntheticCDO::results >, GenericEngine< CdsOption::arguments, CdsOption::results >, GenericEngine< CompoundOption::arguments, CompoundOption::results >, GenericEngine< ContinuousFloatingLookbackOption::arguments, ContinuousFloatingLookbackOption::results >, GenericEngine< CliquetOption::arguments, CliquetOption::results >, GenericEngine< PartialTimeBarrierOption::arguments, PartialTimeBarrierOption::results >, GenericEngine< NthToDefault::arguments, NthToDefault::results >, GenericEngine< FloatFloatSwaption::arguments, FloatFloatSwaption::results >, GenericEngine< OneAssetOption::arguments, OneAssetOption::results >, GenericEngine< DividendBarrierOption::arguments, DividendBarrierOption::results >, GenericEngine< ComplexChooserOption::arguments, ComplexChooserOption::results >, GenericEngine< ContinuousAveragingAsianOption::arguments, ContinuousAveragingAsianOption::results >, GenericEngine< VanillaSwap::arguments, VanillaSwap::results >, GenericEngine< PathMultiAssetOption::arguments, PathMultiAssetOption::results >, GenericEngine< ContinuousPartialFixedLookbackOption::arguments, ContinuousPartialFixedLookbackOption::results >, GenericEngine< VarianceOption::arguments, VarianceOption::results >, GenericEngine< ConvertibleBond::option::arguments, ConvertibleBond::option::results >, GenericEngine< CatBond::arguments, CatBond::results >, GenericEngine< FloatFloatSwap::arguments, FloatFloatSwap::results >, GenericEngine< Swaption::arguments, Swaption::results >, GenericEngine< BarrierOption::arguments, BarrierOption::results >, GenericEngine< VanillaVPPOption::arguments, VanillaVPPOption::results >, GenericEngine< YoYInflationCapFloor::arguments, YoYInflationCapFloor::results >, GenericEngine< WriterExtensibleOption::arguments, WriterExtensibleOption::results >, GenericEngine< CallableBond::arguments, CallableBond::results >, GenericEngine< VanillaOption::arguments, VanillaOption::results >, GenericEngine< DiscreteAveragingAsianOption::arguments, DiscreteAveragingAsianOption::results >, GenericEngine< NonstandardSwaption::arguments, NonstandardSwaption::results >, GenericEngine< Swap::arguments, Swap::results >, GenericEngine< TwoAssetBarrierOption::arguments, TwoAssetBarrierOption::results >, GenericEngine< Instr::arguments, QuantoOptionResults< Instr::results > >, GenericEngine< Bond::arguments, Bond::results >, GenericEngine< DividendVanillaOption::arguments, DividendVanillaOption::results >, GenericEngine< ZeroCouponInflationSwap::arguments, ZeroCouponInflationSwap::results >, GenericEngine< CPICapFloor::arguments, CPICapFloor::results >, GenericEngine< BasketOption::arguments, BasketOption::results >, GenericEngine< DoubleBarrierOption::arguments, DoubleBarrierOption::results >, GenericEngine< SimpleChooserOption::arguments, SimpleChooserOption::results >, LazyObject, MarkovFunctional, Gsr::ReversionObserver, Gsr::VolatilityObserver, Gsr, CalibratedModel, FwdToCotSwapAdapterFactory, FlatVolFactory, CotSwapToFwdAdapterFactory, Claim, RendistatoBasket, InterestRateIndex, InflationIndex, Handle< T >::Link, ZabrInterpolatedSmileSection< Evaluation >, SviInterpolatedSmileSection, SabrVolSurface, NoArbSabrInterpolatedSmileSection, ExtendedBlackVarianceSurface, ExtendedBlackVarianceCurve, AbcdAtmVolCurve, FFTEngine, HestonSLVProcess, LatentModel< copulaPolicyImpl >, LatentModel< GaussianCopulaPolicy >, LatentModel< copulaPolicy >, InterpolatedYoYCapFloorTermPriceSurface< Interpolator2D, Interpolator1D >, PiecewiseYoYOptionletVolatilityCurve< Interpolator, Bootstrap, Traits >, DeltaVolQuote, AssetSwapHelper, ConstantRecoveryModel, RandomDefaultModel, RandomLM< derivedRandomLM, copulaPolicy, USNG >, GaussianLHPLossModel, DefaultLatentModel< copulaPolicy >, Basket, BaseCorrelationTermStructure< Interpolator2D_T >, BaseCorrelationLossModel< BaseModel_T, Corr2DInt_T >, StrippedCappedFlooredCoupon, 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.

Definition at line 241 of file observable.hpp.

Member Data Documentation

◆ observables_

set_type observables_
private

Definition at line 137 of file observable.hpp.