Posted by
Luigi Ballabio on
May 31, 2012; 7:21am
URL: http://quantlib.414.s1.nabble.com/Questions-about-LazyObject-recalculate-tp7823p7824.html
On Wed, May 30, 2012 at 10:58 PM, Mike Jake <
[hidden email]> wrote:
> */
> //@{
> /*! This method force the recalculation of any results which
> would otherwise be cached. It is not declared as
> <tt>const</tt> since it needs to call the
> non-<tt>const</tt> <i><b>notifyObservers</b></i> method.
>
> \note Explicit invocation of this method is <b>not</b>
> necessary if the object registered itself as
> observer with the structures on which such results
> depend. It is strongly advised to follow this
> policy when possible.
> */
> void LazyObject::recalculate();
>
> Based on the above doc, we should not call this function directly if the
> object is registered.
> However, I still cannot figure out how the registered object can call this
> function finally.
It's not that you should not call it, it's more like "this method is
here in case you need to manage recalculation manually, but it's
tricky to get it right so instead we suggest you just register, sit
back and relax". The library does use it in a few places, but it's
mostly in cases in which there's some reason not to register (for
instance during a curve bootstrap, in which registration as usual will
result in a cycle). In the usual scenario, the registered object
doesn't call this and goes through calculate() instead.
Luigi
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users