HI_GapFillBuffer

HI_GapFillBuffer — fills in data gaps found by HI_GapCountBuffer.

Syntax

#include <cogent.h>
ST_STATUS HI_GapFillBuffer(int  nvalues,
 HI_stVALUE*  values,
 int  n2,
 HI_stVALUE*  new_values,
 double  gap);

Arguments

nvalues

The number of values in the values array.

values

An array of HI_stVALUE structures.

n2

The size of the new_values array.

new_values

A new array of HI_stVALUEs to contain the data from values, with duplicate values inserted where the difference in time exceeds gap.

gap

The threshold difference between adjacent X values that determines the existence of a gap.

Returns

t (true) if the function completed successfully, otherwise nil.

Description

This function inserts duplicate Y-value points into the buffer when the X-axis gap between a pair of values exceeds the specified gap threshold. This will cause the graph of the data to show a constant value spanning the gap, rather than a misleading ramp between the points.

This function requires the return value from HI_GapCountBuffer to calculate and allocate the size of the new array that will contain the additional data. These two functions, when used together, correspond to the Cascade Historian hist_gap_buffer dynamic library function.

Example

ngaps = HI_GapCountBuffer(n, values, gap);
n2 = n + ngaps;
new_values = ME_ZMalloc( n2 * sizeof (HI_stVALUE));
HI_GapFillBuffer (n, values, n2, new_values, gap);