Skip to content

Reference

OpcNodeHistory Members

Represents a history of values kept in memory in ascending order of their timestamps, with at most one value per timestamp.

Reference

OpcNodeHistory<T> Members ​

Type
OpcNodeHistory<T>
Namespace
Opc.UaFx.Server
Assembly
Opc.UaFx.Advanced.dll
Package
Opc.UaFx.Advanced v2.59.0

Constructors ​

OpcNodeHistory ​

6 overloads

OverloadDescription
OpcNodeHistory()Initializes a new instance of the OpcNodeHistory<T> class whose Capacity is -1 (unlimited).
OpcNodeHistory(int)Initializes a new instance of the OpcNodeHistory<T> class using the capacity specified.
OpcNodeHistory(IEnumerable<T>)Initializes a new instance of the OpcNodeHistory<T> class using the values specified.
OpcNodeHistory(int, IEnumerable<T>)Initializes a new instance of the OpcNodeHistory<T> class using the capacity and values specified.
OpcNodeHistory(params T[])Initializes a new instance of the OpcNodeHistory<T> class using the values specified.
OpcNodeHistory(int, params T[])Initializes a new instance of the OpcNodeHistory<T> class using the capacity and values specified.

OpcNodeHistory() ​

Initializes a new instance of the OpcNodeHistory<T> class whose Capacity is -1 (unlimited).

csharp
public OpcNodeHistory()
vbnet
Public Sub New()

OpcNodeHistory(int) ​

Initializes a new instance of the OpcNodeHistory<T> class using the capacity specified.

csharp
public OpcNodeHistory(int capacity)
vbnet
Public Sub New(capacity As Integer)

Parameters

NameTypeDescription
capacityInt32The maximum number of values the history keeps: -1 (unlimited) or a positive number.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThe capacity is 0 or less than -1.

OpcNodeHistory(IEnumerable<T>) ​

Initializes a new instance of the OpcNodeHistory<T> class using the values specified. The number of values the history keeps is not limited.

csharp
public OpcNodeHistory(IEnumerable<T> values)
vbnet
Public Sub New(values As IEnumerable(Of T))

Parameters

NameTypeDescription
valuesIEnumerable<T>A sequence of the values to add to the history.

Exceptions

ExceptionCondition
ArgumentExceptionTwo of the values have the same timestamp.
ArgumentNullExceptionThe values or one of its items is a null reference (Nothing in Visual Basic).

OpcNodeHistory(int, IEnumerable<T>) ​

Initializes a new instance of the OpcNodeHistory<T> class using the capacity and values specified.

csharp
public OpcNodeHistory(int capacity, IEnumerable<T> values)
vbnet
Public Sub New(capacity As Integer, values As IEnumerable(Of T))

Parameters

NameTypeDescription
capacityInt32The maximum number of values the history keeps: -1 (unlimited) or a positive number.
valuesIEnumerable<T>A sequence of the values to add to the history.

Exceptions

ExceptionCondition
ArgumentExceptionTwo of the added values have the same timestamp.
ArgumentNullExceptionThe values or one of the added items is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe capacity is 0 or less than -1.

Remarks

If the capacity is not -1, only the last capacity items of the sequence are added, regardless of their timestamps.

OpcNodeHistory(params T[]) ​

Initializes a new instance of the OpcNodeHistory<T> class using the values specified. The number of values the history keeps is not limited.

csharp
public OpcNodeHistory(params T[] values)
vbnet
Public Sub New(ParamArray values As T())

Parameters

NameTypeDescription
valuesparams T[]The values to add to the history.

Exceptions

ExceptionCondition
ArgumentExceptionTwo of the values have the same timestamp.
ArgumentNullExceptionThe values or one of its items is a null reference (Nothing in Visual Basic).

OpcNodeHistory(int, params T[]) ​

Initializes a new instance of the OpcNodeHistory<T> class using the capacity and values specified.

csharp
public OpcNodeHistory(int capacity, params T[] values)
vbnet
Public Sub New(capacity As Integer, ParamArray values As T())

Parameters

NameTypeDescription
capacityInt32The maximum number of values the history keeps: -1 (unlimited) or a positive number.
valuesparams T[]The values to add to the history.

Exceptions

ExceptionCondition
ArgumentExceptionTwo of the added values have the same timestamp.
ArgumentNullExceptionThe values or one of the added items is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe capacity is 0 or less than -1.

Remarks

If the capacity is not -1, only the last capacity items of the array are added, regardless of their timestamps.

Properties ​

Capacity ​

Gets the maximum number of values the history keeps.

csharp
public int Capacity { get; }
vbnet
Public ReadOnly Property Capacity As Integer

Property value

Int32

The maximum number of values: -1 (unlimited) or a positive number.

Remarks

When a value is added to a history which has reached its capacity, the value with the earliest timestamp is removed first, also if the value added is earlier, and the Removed event is raised.

Count ​

Gets the number of values in the history.

csharp
public int Count { get; }
vbnet
Public ReadOnly Property Count As Integer

Property value

Int32

The number of values in the history.

EnableRaisingEvents ​

Gets or sets a value indicating whether the history raises the events Added, Removed and Replaced.

csharp
public bool EnableRaisingEvents { get; set; }
vbnet
Public Property EnableRaisingEvents As Boolean

Property value

Boolean

The value true if the history raises the events; otherwise the value false. The default value is true.

EndTime ​

Gets the latest timestamp of the values in the history.

csharp
public DateTime? EndTime { get; }
vbnet
Public ReadOnly Property EndTime As Date?

Property value

Nullable<DateTime>

The latest timestamp or a null reference (Nothing in Visual Basic) if the history is empty.

StartTime ​

Gets the earliest timestamp of the values in the history.

csharp
public DateTime? StartTime { get; }
vbnet
Public ReadOnly Property StartTime As Date?

Property value

Nullable<DateTime>

The earliest timestamp or a null reference (Nothing in Visual Basic) if the history is empty.

Methods ​

Add ​

Adds the value specified to the history and raises the Added event.

csharp
public void Add(T value)
vbnet
Public Sub Add(value As T)

Parameters

NameTypeDescription
valueTThe value to add.

Exceptions

ExceptionCondition
ArgumentExceptionThe history already contains a value with the timestamp of the value.
ArgumentNullExceptionThe value is a null reference (Nothing in Visual Basic).

Remarks

If the history has reached its Capacity, the value with the earliest timestamp is removed first.

AddRange ​

2 overloads

OverloadDescription
AddRange(IEnumerable<T>)Adds the values specified to the history and raises the Added event.
AddRange(params T[])Adds the values specified to the history and raises the Added event.

Exceptions (all overloads)

ExceptionCondition
ArgumentExceptionThe history already contains a value with the timestamp of one of the values.
ArgumentNullExceptionThe values or one of its items is a null reference (Nothing in Visual Basic).

AddRange(IEnumerable<T>) ​

Adds the values specified to the history and raises the Added event.

csharp
public void AddRange(IEnumerable<T> values)
vbnet
Public Sub AddRange(values As IEnumerable(Of T))

Parameters

NameTypeDescription
valuesIEnumerable<T>A sequence of the values to add.

Remarks

The values are added in the order of the sequence. If a value cannot be added, the method stops and throws the exception; the values added before remain in the history. For a value which already exists, the Added event provides the values added before; for an item which is a null reference, the event is not raised.

AddRange(params T[]) ​

Adds the values specified to the history and raises the Added event.

csharp
public void AddRange(params T[] values)
vbnet
Public Sub AddRange(ParamArray values As T())

Parameters

NameTypeDescription
valuesparams T[]The values to add.

Remarks

The values are added in the order of the array. If a value cannot be added, the method stops and throws the exception; the values added before remain in the history. For a value which already exists, the Added event provides the values added before; for an item which is a null reference, the event is not raised.

Clear ​

Removes all values from the history and raises the Removed event.

csharp
public void Clear()
vbnet
Public Sub Clear()

Contains ​

2 overloads

OverloadDescription
Contains(DateTime)Determines whether the history contains a value at the timestamp specified.
Contains(T)Determines whether the history contains the value specified.

Contains(DateTime) ​

Determines whether the history contains a value at the timestamp specified.

csharp
public bool Contains(DateTime timestamp)
vbnet
Public Function Contains(timestamp As Date) As Boolean

Parameters

NameTypeDescription
timestampDateTimeThe timestamp to look for.

Returns

Boolean

The value true if the history contains a value at the timestamp; otherwise the value false.

Contains(T) ​

Determines whether the history contains the value specified.

csharp
public bool Contains(T value)
vbnet
Public Function Contains(value As T) As Boolean

Parameters

NameTypeDescription
valueTThe value to look for.

Returns

Boolean

The value true if the value of the history at the timestamp of the value is equal to the value; otherwise the value false.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe value is a null reference (Nothing in Visual Basic).

Enumerate ​

3 overloads

OverloadDescription
Enumerate()Enumerates the values of the history in ascending order of their timestamps.
Enumerate(DateTime?)
Enumerate(DateTime?, DateTime?)

Enumerate() ​

Enumerates the values of the history in ascending order of their timestamps.

csharp
public IEnumerable<T> Enumerate()
vbnet
Public Function Enumerate() As IEnumerable(Of T)

Returns

IEnumerable<T>

A sequence of the values of the history.

Remarks

The history stays locked while the sequence is enumerated, so that other threads which access the history wait until the enumeration has completed or the enumerator has been disposed.

Enumerate(DateTime?) ​

csharp
public IEnumerable<T> Enumerate(DateTime? startTime)
vbnet
Public Function Enumerate(startTime As Date?) As IEnumerable(Of T)

Parameters

NameTypeDescription
startTimeNullable<DateTime>

Returns

IEnumerable<T>

Enumerate(DateTime?, DateTime?) ​

csharp
public IEnumerable<T> Enumerate(DateTime? startTime, DateTime? endTime)
vbnet
Public Function Enumerate(
    startTime As Date?,
    endTime As Date?) As IEnumerable(Of T)

Parameters

NameTypeDescription
startTimeNullable<DateTime>
endTimeNullable<DateTime>

Returns

IEnumerable<T>

GetEnumerator ​

Returns an enumerator which iterates through the values of the history in ascending order of their timestamps.

csharp
public IEnumerator<T> GetEnumerator()
vbnet
Public Function GetEnumerator() As IEnumerator(Of T)

Returns

IEnumerator<T>

An enumerator for the values of the history.

Implements

GetEnumerator()

Remarks

The history stays locked while the enumerator is used, so that other threads which access the history wait until the enumeration has completed or the enumerator has been disposed.

OnAdded ​

protected · virtual

Raises the Added event using the specified event data.

csharp
protected virtual void OnAdded(OpcNodeHistoryEventArgs<T> e)
vbnet
Protected Overridable Sub OnAdded(e As OpcNodeHistoryEventArgs(Of T))

Parameters

NameTypeDescription
eOpcNodeHistoryEventArgs<T>The OpcNodeHistoryEventArgs<T> with the values added.

OnRemoved ​

protected · virtual

Raises the Removed event using the specified event data.

csharp
protected virtual void OnRemoved(OpcNodeHistoryEventArgs<T> e)
vbnet
Protected Overridable Sub OnRemoved(e As OpcNodeHistoryEventArgs(Of T))

Parameters

NameTypeDescription
eOpcNodeHistoryEventArgs<T>The OpcNodeHistoryEventArgs<T> with the values removed.

OnReplaced ​

protected · virtual

Raises the Replaced event using the specified event data.

csharp
protected virtual void OnReplaced(OpcNodeHistoryEventArgs<T> e)
vbnet
Protected Overridable Sub OnReplaced(e As OpcNodeHistoryEventArgs(Of T))

Parameters

NameTypeDescription
eOpcNodeHistoryEventArgs<T>The OpcNodeHistoryEventArgs<T> with the values replaced.

Remove ​

Removes the value specified from the history and raises the Removed event.

csharp
public bool Remove(T value)
vbnet
Public Function Remove(value As T) As Boolean

Parameters

NameTypeDescription
valueTThe value to remove.

Returns

Boolean

The value true if the history contained the value (see Contains) and the value has been removed; otherwise the value false.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe value is a null reference (Nothing in Visual Basic).

RemoveAt ​

4 overloads

OverloadDescription
RemoveAt(int)Removes the value at the index specified in the ascending order of the timestamps and raises the Removed event.
RemoveAt(DateTime)Removes the value at the timestamp specified and raises the Removed event.
RemoveAt(IEnumerable<DateTime>)Removes the values at the timestamps specified and raises the Removed event.
RemoveAt(params DateTime[])Removes the values at the timestamps specified and raises the Removed event.

RemoveAt(int) ​

Removes the value at the index specified in the ascending order of the timestamps and raises the Removed event.

csharp
public void RemoveAt(int index)
vbnet
Public Sub RemoveAt(index As Integer)

Parameters

NameTypeDescription
indexInt32The zero-based index of the value to remove.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThe index is less than zero or not less than Count.

RemoveAt(DateTime) ​

Removes the value at the timestamp specified and raises the Removed event.

csharp
public void RemoveAt(DateTime timestamp)
vbnet
Public Sub RemoveAt(timestamp As Date)

Parameters

NameTypeDescription
timestampDateTimeThe timestamp of the value to remove.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThe history contains no value at the timestamp.

RemoveAt(IEnumerable<DateTime>) ​

Removes the values at the timestamps specified and raises the Removed event.

csharp
public void RemoveAt(IEnumerable<DateTime> timestamps)
vbnet
Public Sub RemoveAt(timestamps As IEnumerable(Of Date))

Parameters

NameTypeDescription
timestampsIEnumerable<DateTime>A sequence of the timestamps of the values to remove.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe timestamps is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe history contains no value at one of the timestamps.

Remarks

The values are removed in the order of the sequence. If the history contains no value at a timestamp, the method stops and throws the exception; the values removed before stay removed.

RemoveAt(params DateTime[]) ​

Removes the values at the timestamps specified and raises the Removed event.

csharp
public void RemoveAt(params DateTime[] timestamps)
vbnet
Public Sub RemoveAt(ParamArray timestamps As Date())

Parameters

NameTypeDescription
timestampsparams DateTime[]The timestamps of the values to remove.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe timestamps is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe history contains no value at one of the timestamps.

Remarks

The values are removed in the order of the array. If the history contains no value at a timestamp, the method stops and throws the exception; the values removed before stay removed.

RemoveRange ​

2 overloads

OverloadDescription
RemoveRange(DateTime?)
RemoveRange(DateTime?, DateTime?)

RemoveRange(DateTime?) ​

csharp
public void RemoveRange(DateTime? startTime)
vbnet
Public Sub RemoveRange(startTime As Date?)

Parameters

NameTypeDescription
startTimeNullable<DateTime>

Exceptions

ExceptionCondition
ArgumentOutOfRangeException

RemoveRange(DateTime?, DateTime?) ​

csharp
public void RemoveRange(DateTime? startTime, DateTime? endTime)
vbnet
Public Sub RemoveRange(startTime As Date?, endTime As Date?)

Parameters

NameTypeDescription
startTimeNullable<DateTime>
endTimeNullable<DateTime>

Replace ​

Replaces the value at the timestamp of the value specified with the value and raises the Replaced event.

csharp
public void Replace(T value)
vbnet
Public Sub Replace(value As T)

Parameters

NameTypeDescription
valueTThe new value.

Exceptions

ExceptionCondition
ArgumentExceptionThe history contains no value at the timestamp of the value.
ArgumentNullExceptionThe value is a null reference (Nothing in Visual Basic).

Events ​

Added ​

Occurs after values have been added to the history.

csharp
public event EventHandler<OpcNodeHistoryEventArgs<T>> Added
vbnet
Public Event Added As EventHandler(Of OpcNodeHistoryEventArgs(Of T))

Event type

EventHandler<OpcNodeHistoryEventArgs<T>>

Remarks

A method which adds several values raises the event once for all values added, also if no value has been added. The event is not raised while EnableRaisingEvents is false.

Removed ​

Occurs after values have been removed from the history, also if a value has been removed because the history reached its Capacity.

csharp
public event EventHandler<OpcNodeHistoryEventArgs<T>> Removed
vbnet
Public Event Removed As EventHandler(Of OpcNodeHistoryEventArgs(Of T))

Event type

EventHandler<OpcNodeHistoryEventArgs<T>>

Remarks

A method which removes several values raises the event once for all values removed, also if no value has been removed. The event is not raised while EnableRaisingEvents is false.

Replaced ​

Occurs after a value of the history has been replaced.

csharp
public event EventHandler<OpcNodeHistoryEventArgs<T>> Replaced
vbnet
Public Event Replaced As EventHandler(Of OpcNodeHistoryEventArgs(Of T))

Event type

EventHandler<OpcNodeHistoryEventArgs<T>>

Remarks

The Values of the event data provide the values which have been replaced, not the new values. The event is not raised while EnableRaisingEvents is false.

Indexers ​

Item ​

2 overloads

OverloadDescription
this[int]Gets or sets the value at the index specified in the ascending order of the timestamps.
this[DateTime]Gets or sets the value at the timestamp specified.

this[int] ​

Gets or sets the value at the index specified in the ascending order of the timestamps.

csharp
public T this[int index] { get; set; }
vbnet
Public Default Property this[](index As Integer) As T

Parameters

NameTypeDescription
indexInt32The zero-based index of the value.

Property value

T

The value at the index specified.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThe index is less than zero or not less than Count.

Remarks

The setter replaces the value at the timestamp of the value at the index without comparing the timestamp of the new value and raises the Replaced event. To replace a value by its own timestamp use Replace.

this[DateTime] ​

Gets or sets the value at the timestamp specified.

csharp
public T this[DateTime timestamp] { get; set; }
vbnet
Public Default Property this[](timestamp As Date) As T

Parameters

NameTypeDescription
timestampDateTimeThe timestamp of the value.

Property value

T

The value at the timestamp specified.

Exceptions

ExceptionCondition
KeyNotFoundExceptionThe history contains no value at the timestamp specified.

Remarks

The setter replaces the value at the timestamp without comparing the timestamp of the new value and raises the Replaced event. To replace a value by its own timestamp use Replace.