HI_Bufsize

HI_Bufsize — sets the history buffer size.

Syntax

#include <cogent.h>
ST_STATUS HI_Bufsize(IP_hTASK  historian,
 char*  retbuf,
 int  buflen,
 char*  histname,
 int  numvalues,
 int  size);

Arguments

historian

The task pointer to the Cascade Historian program.

retbuf

An optional buffer containing an error message.

buflen

The length in bytes of retbuf. If retbuf is non-NULL, this must be a valid non-zero length. If retbuf is NULL, this parameter is ignored.

histname

The name of a history.

numvalues

The new maximum number of value/time (or y/x) pairs that can be buffered for this history. If 0 is specified, then the function is treated as a query, the buffer size is not modified, and the current value is returned in size.

size

A pointer to an integer variable that is set to the current maximum number of value/time (or y/x) pairs that can be buffered for this history.

Returns

ST_OK on success. Otherwise ST_ERROR, and the retbuf will contain a NULL-terminated character string with an error message. If the return value is ST_OK, the retbuf may not contain useful information.

Description

This function sets the number of data values that will be buffered for the specified history. (There are actually up to twice this number stored at any time, as the Cascade Historian double-buffers its data storage.) When a buffer is full, the data is flushed to disk, as long as an associated file has been assigned (with filebase or HI_FileBase). A larger buffer will retain more data in memory and increase the speed of queries on that data if it is within the range of the data in the buffer.

The history data is flushed to disk whenever this function is called. Until this function is used, the history buffer size is set to the initial default value (100).

This function corresponds to the Cascade Historian bufsize command and the hist_bufsize dynamic library function.