Link Class Template Reference

#include <ql/relinkablehandle.hpp>

Inheritance diagram for Link:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class Type>
class QuantLib::Link< Type >

Relinkable access to a shared pointer.

Precondition:
Class "Type" must inherit from Observable


Public Member Functions

 Link (const boost::shared_ptr< Type > &h=boost::shared_ptr< Type >(), bool registerAsObserver=true)
void linkTo (const boost::shared_ptr< Type > &, bool registerAsObserver=true)
bool isNull () const
 Checks if the contained handle points to anything.

const boost::shared_ptr< Type > & currentLink () const
 Returns the contained handle.

void update ()
 Observer interface.


Constructor & Destructor Documentation

Link const boost::shared_ptr< Type > &  h = boost::shared_ptr< Type >(),
bool  registerAsObserver = true
[explicit]
 

Warning:
see the documentation of the linkTo method for issues relatives to registerAsObserver.


Member Function Documentation

void linkTo const boost::shared_ptr< Type > &  ,
bool  registerAsObserver = true
 

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 handle was created with owns = false (the latter 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 relinkable handle to register as observer of such a handle, it is his responsibility to ensure that the relinkable handle gets destroyed before the pointed object does.


QuantLib.org
QuantLib
Hosted by
SourceForge.net Logo
Documentation generated by
doxygen