HistoryBufferHistoryBuffer — a set of HistoryValues returned from a Historian
query.
class HistoryBuffer
{
npoints;
}
npointsThe number of values (of type HistoryValue) in this data
set.
Result sets from historical queries can be large. Consequently the access
methods for a result set come in two types. The first type, named
get, will
return a reference to the particular data array or item, without making a copy.
This reference is only valid until the SomethingHistoryBuffer
instance is destroyed, which may happen at any time after all references to the
HistoryBuffer instance go out of scope.
![]() | |
If the |
Alternately, you can use the
copy
methods to create duplicates of the data requested. These instances will persist
after the SomethingHistoryBuffer is destroyed. The
copy methods are more robust, but increase the CPU
usage and memory usage of large queries. In general you should use the copy
methods when you are unsure whether the lifetimes of the
HistoryValues will exceed the lifetime of the
HistoryBuffer.
copyToArray()Copy the internal data representation to an array of
HistoryValue instances. This method
returns the new array. This method is similar to
toArray, except that it makes a copy of
each HistoryValue instance.
copyValue(index)Returns a copy of the HistoryValue at the
given index within the data set. The
index is a number starting at 0 and less
then npoints. This is the safe version of the
getValue method.
getCount()Returns the number of values in this data set.
getValue(index)Returns the HistoryValue at the given index
in the data set. This is the unsafe version of
copyValue. It will return a reference
to the HistoryValue within the
HistoryBuffer. This reference will only
be valid until the HistoryBuffer is
destroyed.
setValue(index,
histvalue)Modifies the original data in the
HistoryBuffer at the given
index. This method will result in changes
to the original data, and to any HistoryValue
instances that have been acquired by reference using
getValue or
toArray. The
histvalue argument is an instance of
HistoryValue.
toArray()Returns an array of HistoryValue instances
as references to the original data. This is equivalent to creating
an array by repeatedly calling getValue.
The resulting data is only valid until the
HistoryBuffer is destroyed.