QuantLib
A free/open-source library for quantitative finance
Reference manual - version 1.20
Public Member Functions | List of all members
RelinkableHandle< T > Class Template Reference

Relinkable handle to an observable. More...

#include <ql/handle.hpp>

+ Inheritance diagram for RelinkableHandle< T >:

Public Member Functions

 RelinkableHandle (const ext::shared_ptr< T > &p=ext::shared_ptr< T >(), bool registerAsObserver=true)
 
 RelinkableHandle (T *p, bool registerAsObserver=true)
 
void linkTo (const ext::shared_ptr< T > &, bool registerAsObserver=true)
 
- Public Member Functions inherited from Handle< T >
 Handle (const ext::shared_ptr< T > &p=ext::shared_ptr< T >(), bool registerAsObserver=true)
 
const ext::shared_ptr< T > & currentLink () const
 dereferencing
 
const ext::shared_ptr< T > & operator-> () const
 
const ext::shared_ptr< T > & operator* () const
 
bool empty () const
 checks if the contained shared pointer points to anything
 
 operator ext::shared_ptr< Observable > () const
 allows registration as observable
 
template<class U >
bool operator== (const Handle< U > &other) const
 equality test
 
template<class U >
bool operator!= (const Handle< U > &other) const
 disequality test
 
template<class U >
bool operator< (const Handle< U > &other) const
 strict weak ordering
 

Additional Inherited Members

- Protected Attributes inherited from Handle< T >
ext::shared_ptr< Link > link_
 

Detailed Description

template<class T>
class QuantLib::RelinkableHandle< T >

Relinkable handle to an observable.

An instance of this class can be relinked so that it points to another observable. The change will be propagated to all handles that were created as copies of such instance.

Precondition
Class T must inherit from Observable
Warning:
see the Handle documentation for issues relatives to registerAsObserver.
Examples
Bonds.cpp, FittedBondCurve.cpp, FRA.cpp, Gaussian1dModels.cpp, MulticurveBootstrapping.cpp, and Repo.cpp.