HI_GapFillBuffer

Cogent API and Utilities: Version 4.1
Prev |  | Next

# `HI_GapFillBuffer`

`HI_GapFillBuffer` -- fills in data gaps found by `HI_GapCountBuffer`.

## Syntax

    #include <cogent/cogent.h>

``ST_STATUS HI_GapFillBuffer`(int nvalues, HI_stVALUE* values, int n2, HI_stVALUE* new_values, double gap);`

## Parameters

`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_stVALUE`s 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);

Prev | Home | Next
`HI_GapCountBuffer` | Up | `HI_History`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.