Login  Register

Looping dependencies

Posted by Luca Billi on Feb 05, 2012; 8:26pm
URL: http://quantlib.414.s1.nabble.com/Looping-dependencies-tp13460.html

I noticed that the current implementation of LazyObjects generates
infinite recursions
in the case the dependency hierarchy among Observer/Observable objects
contains loops.

A suggestion to break the infinite recursion is to replace the update()
method as follows:

 void LazyObject::update() {

      if (!frozen_&& calculated_){
        //
        // Set calculated_=false before calling notifyObservers()
        //
        calculated_ = false;

        notifyObservers();
      }

      calculated_ = false;
 }


Luca

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev