Hi,
I have problem understanding the Handle, RelinkableHandle classes.
Why do we need the RelinkableHandle?
Here is function of linkTo in the RelinkableHandle class:
template
|
Hi Emma,
inside RelinkableHandle::linkTo, we don't call the linkTo method of the base class; instead, we call the linkTo method of the protected link_ data member, which is not accessible from the outside. The Handle base class doesn't have a linkTo method, so you can't relink it. The general idea is that you'll set up a number of relinkable handles which will be linked to the current market conditions and passed to the instruments that need them. The main code will create them as RelinkableHandle instances, so that it can relink them if necessary (and all instruments will see the change). Instead, when they are passed to the instruments, they are converted and saved as Handle instances; this prevent the instruments from changing them. The instruments have no reason to do it; if they want to change the curves or the quotes they're using in order to perform some calculations---calibrations, minimizations, whatever---they should use copies of the handles instead, because changing the very handles they are using would have consequences on all the other instruments that happen to share those handles. Preventing Handle instances from relinking helps avoiding this error. Hope this helps, Luigi On Tue, Jun 4, 2013 at 9:49 PM, emmajyu <[hidden email]> wrote: > Hi, I have problem understanding the Handle, RelinkableHandle classes. Why > do we need the RelinkableHandle? Here is function of linkTo in the > RelinkableHandle class: template inline void RelinkableHandle::linkTo(const > boost::shared_ptr& h, bool registerAsObserver) { > this->link_->linkTo(h,registerAsObserver); } It does not do anything > different from the base class but calling the baseClass link_->linkTo, I > dont see diff from the base class here at all. Why do we still need the > RelinkableHandle class? Thanks a lot for your help! > ________________________________ > View this message in context: RelinkableHandle > Sent from the quantlib-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |