This method performs all needed calculations by calling
the performCalculations
method.
warning Objects cache the results of the previous
calculation. Such results will be returned upon
later invocations of
calculate
. When the results depend
on arguments which could change between
invocations, the lazy object must register itself
as observer of such objects for the calculations
to be performed again when they change.
warning Should this method be redefined in derived classes, LazyObject.calculate() should be called in the overriding method.
This method constrains the object to return the presently cached results on successive invocations, even if arguments upon which they depend should change.
This method force the recalculation of any results which
would otherwise be cached. It is not declared as
const
since it needs to call the
non-const
notifyObservers
method.
note Explicit invocation of this method is not 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.
This method reverts the effect of the freeze
method, thus re-enabling recalculations.
Observer interface
This method causes the object to forward all notifications, even when not calculated. The default behavior is to forward the first notification received, and discard the others until recalculated; the rationale is that observers were already notified, and don't need further notification until they recalculate, at which point this object would be recalculated too. After recalculation, this object would again forward the first notification received.
warning Forwarding all notifications will cause a performance hit, and should be used only when discarding notifications cause an incorrect behavior.