Version

UCReference Class

Implements the IUltraCalcReference and provides methods to connect and disconnect from an underlying calculation object reference
Syntax
'Declaration
 
Public Class UCReference 
   Implements IUltraCalcReference 
public class UCReference : IUltraCalcReference  
Remarks

UCReference wraps an internal IUltraCalcReference class instance that points to the underlying object. That is, each method simply passes the IUltraCalcReference request to the underlying reference if the object is connected, else it returns, or throws, an appropriate error. UCReference has storage for the reference string and its underlying reference object.

There are two additional methods on UCReference: Connect and Disconnect.

Connect will attempt to obtain a reference to the object it refers to given a base reference and it's reference string by calling the base reference's CreateReference method passing it the reference string. If its successful, it will store the newly created reference and use it to dispatch IUltraCalcReference requests against it.

Disconnect will simply free the internal reference object after which its IUltraCalcReference methods will deal with a disconnected state.

Virtually all references can be in a disconnected state at some point in their lifetime, therefore the CalcEngine uses UCReference instances to connect to all references. That is, the UltraCalcFormulaCompiler.Compile method creates UCRefernces for the all references in the formula string. The CalcEngine exposes a TopoChange event that objects used to notify it of topological changes. The TopoChange event passes a reference to the CalcEngine that describes the object that changed (e.g. column, row, grid, etc) along with a Create / Delete action argument.

On Delete events, the CalcEngine will track down all formulas whose LHS is contained by the disconnected reference and delete them. This will clean up the recalc chain and ancestor map of any references including sub-references under the deleted reference. That is, column formulas will be deleted when the event's deleted reference is an entire grid, or cell references that are on the recalc chain when the deleted reference is a column. The ContainsReference on the reference passed with the TopoChange event determines whether the event affects a given reference. Secondly, all formulas who reference the deleted reference will be recalculated.

On Create events, the CalcEngine will track down all references contained by the created reference and call the Connect method passing in the their formula's BaseReference. This will cause the CalcReference to reconnect to the underlying reference. Secondly, each re-connected reference's ancestor's will be recalculated.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also