QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ObservableValue< T > Class Template Reference

observable and assignable proxy to concrete value More...

#include <ql/utilities/observablevalue.hpp>

+ Inheritance diagram for ObservableValue< T >:
+ Collaboration diagram for ObservableValue< T >:

Public Member Functions

 ObservableValue ()
 
 ObservableValue (T &&)
 
 ObservableValue (const T &)
 
 ObservableValue (const ObservableValue< T > &)
 
 ~ObservableValue ()=default
 

controlled assignment

value_
 
ext::shared_ptr< Observableobservable_
 
ObservableValue< T > & operator= (T &&)
 
ObservableValue< T > & operator= (const T &)
 
ObservableValue< T > & operator= (const ObservableValue< T > &)
 
 operator T () const
 implicit conversion More...
 
 operator ext::shared_ptr< Observable > () const
 
const T & value () const
 explicit inspector More...
 

Detailed Description

template<class T>
class QuantLib::ObservableValue< T >

observable and assignable proxy to concrete value

Observers can be registered with instances of this class so that they are notified when a different value is assigned to such instances. Client code can copy the contained value or pass it to functions via implicit conversion.

Note
it is not possible to call non-const method on the returned value. This is by design, as this possibility would necessarily bypass the notification code; client code should modify the value via re-assignment instead.

Definition at line 42 of file observablevalue.hpp.

Constructor & Destructor Documentation

◆ ObservableValue() [1/4]

Definition at line 69 of file observablevalue.hpp.

◆ ObservableValue() [2/4]

ObservableValue ( T &&  t)

Definition at line 73 of file observablevalue.hpp.

◆ ObservableValue() [3/4]

ObservableValue ( const T &  t)

Definition at line 77 of file observablevalue.hpp.

◆ ObservableValue() [4/4]

ObservableValue ( const ObservableValue< T > &  t)

Definition at line 81 of file observablevalue.hpp.

◆ ~ObservableValue()

~ObservableValue ( )
default

Member Function Documentation

◆ operator=() [1/3]

ObservableValue< T > & operator= ( T &&  t)

Definition at line 85 of file observablevalue.hpp.

+ Here is the caller graph for this function:

◆ operator=() [2/3]

ObservableValue< T > & operator= ( const T &  t)

Definition at line 92 of file observablevalue.hpp.

◆ operator=() [3/3]

ObservableValue< T > & operator= ( const ObservableValue< T > &  t)

Definition at line 100 of file observablevalue.hpp.

◆ operator T()

operator T

implicit conversion

Definition at line 107 of file observablevalue.hpp.

◆ operator ext::shared_ptr< Observable >()

operator ext::shared_ptr< Observable >

Definition at line 112 of file observablevalue.hpp.

◆ value()

const T & value

explicit inspector

Definition at line 117 of file observablevalue.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ value_

T value_
private

Definition at line 61 of file observablevalue.hpp.

◆ observable_

ext::shared_ptr<Observable> observable_
private

Definition at line 62 of file observablevalue.hpp.