Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

QuantLib::Handle< T > Class Template Reference

#include <handle.hpp>

Inheritance diagram for QuantLib::Handle< T >:

QuantLib::RelinkableHandle< T >

List of all members.


Detailed Description

template<class T>
class QuantLib::Handle< T >

Shared handle to an observable.

All copies of an instance of this class refer to the same observable by means of a relinkable smart pointer. When such pointer is relinked to another observable, the change will be propagated to all the copies.

Precondition:
Class T must inherit from Observable

Definition at line 41 of file handle.hpp.


Public Member Functions

const boost::shared_ptr< T > & currentLink () const
 dereferencing
bool empty () const
 checks if the contained shared pointer points to anything
 operator boost::shared_ptr< Observable > () const
 allows registration as observable
template<class U>
bool operator!= (const Handle< U > &other)
 disequality test
const boost::shared_ptr< T > & operator* () const
const boost::shared_ptr< T > & operator-> () const
template<class U>
bool operator< (const Handle< U > &other)
 strict weak ordering
template<class U>
bool operator== (const Handle< U > &other)
 equality test
Constructors
Warning:
registerAsObserver is left as a backdoor in case the programmer cannot guarantee that the object pointed to will remain alive for the whole lifetime of the handle---namely, it should be set to false when the passed shared pointer does not own the pointee (this should only happen in a controlled environment, so that the programmer is aware of it). Failure to do so can very likely result in a program crash. If the programmer does want the handle to register as observer of such a shared pointer, it is his responsibility to ensure that the handle gets destroyed before the pointed object does.


 Handle (T *p, bool registerAsObserver=true)
 Handle (const boost::shared_ptr< T > &p=boost::shared_ptr< T >(), bool registerAsObserver=true)

Protected Attributes

boost::shared_ptr< Link > link_

Classes

class  Link

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index