/// <summary> /// Sets the default compare action to use for this element. /// </summary> /// <param name="compareActionConstraint">The constraint to use for the element quick action.</param> /// <param name="compareActionValue">The value to use for the element quick action.</param> private void SetCompareAction(ConstraintsEnum compareActionConstraint, Object compareActionValue) { switch (compareActionConstraint) { case ConstraintsEnum.Unchanged: this.Compare = this.Unchanged; break; case ConstraintsEnum.Changed: this.Compare = this.Changed; break; case ConstraintsEnum.Increased: this.Compare = this.Increased; break; case ConstraintsEnum.Decreased: this.Compare = this.Decreased; break; case ConstraintsEnum.IncreasedByX: this.Compare = () => this.IncreasedByValue(compareActionValue); break; case ConstraintsEnum.DecreasedByX: this.Compare = () => this.DecreasedByValue(compareActionValue); break; case ConstraintsEnum.Equal: this.Compare = () => this.EqualToValue(compareActionValue); break; case ConstraintsEnum.NotEqual: this.Compare = () => this.NotEqualToValue(compareActionValue); break; case ConstraintsEnum.GreaterThan: this.Compare = () => this.GreaterThanValue(compareActionValue); break; case ConstraintsEnum.GreaterThanOrEqual: this.Compare = () => this.GreaterThanOrEqualToValue(compareActionValue); break; case ConstraintsEnum.LessThan: this.Compare = () => this.LessThanValue(compareActionValue); break; case ConstraintsEnum.LessThanOrEqual: this.Compare = () => this.LessThanValue(compareActionValue); break; case ConstraintsEnum.NotScientificNotation: this.Compare = this.IsScientificNotation; break; } }
/// <summary> /// Initializes a new instance of the <see cref="SnapshotElementIterator" /> class. /// </summary> /// <param name="parent">The parent region that contains this element.</param> /// <param name="elementIndex">The index of the element to begin pointing to.</param> /// <param name="compareActionConstraint">The constraint to use for the element quick action.</param> /// <param name="compareActionValue">The value to use for the element quick action.</param> /// <param name="pointerIncrementMode">The method by which to increment element pointers.</param> public unsafe SnapshotElementIterator( SnapshotRegion parent, Int32 elementIndex = 0, PointerIncrementMode pointerIncrementMode = PointerIncrementMode.AllPointers, ConstraintsEnum compareActionConstraint = ConstraintsEnum.Changed, Object compareActionValue = null) { this.Parent = parent; // The garbage collector can relocate variables at runtime. Since we use unsafe pointers, we need to keep these pinned this.CurrentValuesHandle = GCHandle.Alloc(this.Parent.CurrentValues, GCHandleType.Pinned); this.PreviousValuesHandle = GCHandle.Alloc(this.Parent.PreviousValues, GCHandleType.Pinned); this.InitializePointers(elementIndex); this.SetConstraintFunctions(); this.SetPointerFunction(pointerIncrementMode); this.SetCompareAction(compareActionConstraint, compareActionValue); }
/// <summary> /// Gets the enumerator for an element reference within this snapshot region. /// </summary> /// <param name="pointerIncrementMode">The method for incrementing pointers.</param> /// <param name="compareActionConstraint">The constraint to use for the element quick action.</param> /// <param name="compareActionValue">The value to use for the element quick action.</param> /// <returns>The enumerator for an element reference within this snapshot region.</returns> public IEnumerator <SnapshotElementIterator> IterateElements( PointerIncrementMode pointerIncrementMode, ConstraintsEnum compareActionConstraint = ConstraintsEnum.Changed, Object compareActionValue = null) { UInt64 elementCount = this.ElementCount; SnapshotElementIterator snapshotElement = new SnapshotElementIterator( parent: this, pointerIncrementMode: pointerIncrementMode, compareActionConstraint: compareActionConstraint, compareActionValue: compareActionValue); for (UInt64 index = 0; index < elementCount; index++) { yield return(snapshotElement); snapshotElement.IncrementPointers(); } }
/// <summary> /// Changes the current scan constraint. /// </summary> /// <param name="constraint">The new scan constraint.</param> private void ChangeScanConstraintSelection(ConstraintsEnum constraint) { this.CurrentScanConstraint.Constraint = constraint; this.UpdateAllProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="ScanConstraint" /> class. /// </summary> /// <param name="valueConstraint">The constraint type.</param> /// <param name="addressValue">The value associated with this constraint.</param> public ScanConstraint(ConstraintsEnum valueConstraint, dynamic addressValue = null) { this.Constraint = valueConstraint; this.ConstraintValue = addressValue; }