/// <summary> /// Creates a new <see cref="ExceptionFilterResultDetails"/> object. /// </summary> /// <param name="rejected">Flags if the incoming value was rejected by the filter or not.</param> /// <param name="reason">The reason that the incoming value was (or wasn't) rejected.</param> /// <param name="lastExceptionValue"> /// The last exception value for the tag at the point that the incoming value was received. /// </param> /// <param name="settings">The compression filter settings when the incoming value was received.</param> /// <param name="limits">The compression limit values that were applied to the incoming value.</param> internal ExceptionFilterResultDetails(bool rejected, string reason, TagValue lastExceptionValue, TagValueFilterSettings settings, ExceptionLimits limits) { Rejected = rejected; Reason = reason; LastExceptionValue = lastExceptionValue; Settings = new TagValueFilterSettings(settings.IsEnabled, settings.LimitType, settings.Limit, settings.WindowSize); Limits = limits; }
/// <summary> /// Creates a new <see cref="CompressionFilterResultDetails"/> object. /// </summary> /// <param name="rejected">Flags if the incoming value was rejected by the filter or not.</param> /// <param name="reason">The reason that the incoming value was (or wasn't) rejected.</param> /// <param name="lastAchivedValue"> /// The last-archived value for the tag at the point that incoming value was received. /// </param> /// <param name="lastReceivedValue"> /// The last-received value for the tag at the point that the incoming value was received /// (i.e. the value that was received by the compression filter immediately before the /// incoming value). /// </param> /// <param name="settings">The compression filter settings when the incoming value was received.</param> /// <param name="limits">The compression limit values that were applied to the incoming value.</param> internal CompressionFilterResultDetails(bool rejected, string reason, TagValue lastAchivedValue, TagValue lastReceivedValue, TagValueFilterSettings settings, CompressionLimits limits) { Rejected = rejected; Reason = reason; LastArchivedValue = lastAchivedValue; LastReceivedValue = lastReceivedValue; if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Settings = new TagValueFilterSettings(settings.IsEnabled, settings.LimitType, settings.Limit, settings.WindowSize); Limits = limits ?? throw new ArgumentNullException(nameof(limits)); }
/// <summary> /// Creates a new <see cref="CompressionFilterState"/> object. /// </summary> /// <param name="settings">The filter settings to use.</param> /// <param name="lastArchivedValue"> /// The last-archived value to initialise the compression filter with. This value, combined /// with <paramref name="lastReceivedValue"/>, defines the initial compression angle that /// incoming values are compared with to determine if a value must be archived or not. If /// either <paramref name="lastArchivedValue"/> or <paramref name="lastReceivedValue"/> /// are not set, the compression filter will require multiple incoming values to be passed to /// it before it starts applying the compression rules as expected. /// </param> /// <param name="lastReceivedValue"> /// The initial last-received value for the compression filter. This value, combined with /// <paramref name="lastArchivedValue"/>, defines the initial compression angle that /// incoming values are compared with to determine if a value must be archived or not. If /// either <paramref name="lastArchivedValue"/> or <paramref name="lastReceivedValue"/> /// are not set, the compression filter will require multiple incoming values to be passed to /// it before it starts applying the compression rules as expected. /// </param> /// <param name="compressionMinimum"> /// The minimum compression angle value, calculated when <paramref name="lastReceivedValue"/> /// was passed to the compression filter. /// </param> /// <param name="compressionMaximum"> /// The minimum compression angle value, calculated when <paramref name="lastReceivedValue"/> /// was passed to the compression filter. /// </param> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentException"><paramref name="lastArchivedValue"/> and <paramref name="lastReceivedValue"/> are both defined, and <paramref name="lastArchivedValue"/> has a sample time that is greater than <paramref name="lastReceivedValue"/>.</exception> public CompressionFilterState(TagValueFilterSettings settings, TagValue lastArchivedValue, TagValue lastReceivedValue, double compressionMinimum, double compressionMaximum) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); if (lastArchivedValue != null && lastReceivedValue != null && lastArchivedValue.UtcSampleTime > lastReceivedValue.UtcSampleTime) { throw new ArgumentException(Resources.Error_CompressionFilter_LastArchivedValueCannotBeNewerThanLastReceivedValue, nameof(lastArchivedValue)); } LastArchivedValue = lastArchivedValue; LastReceivedValue = lastReceivedValue; CompressionAngleMinimum = compressionMinimum; CompressionAngleMaximum = compressionMaximum; }
/// <summary> /// Creates a new <see cref="ExceptionFilterState"/> object. /// </summary> /// <param name="settings">The settings to use.</param> /// <param name="initialExceptionValue"> /// The initial exception value that the filter should use. If <see langword="null"/>, the /// first value passed to the filter will always be considered to be exceptional. /// </param> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is <see langword="null"/>.</exception> public ExceptionFilterState(TagValueFilterSettings settings, TagValue initialExceptionValue) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); LastExceptionValue = initialExceptionValue; LastReceivedValue = initialExceptionValue; }