hist_filebase

hist_filebase — associates the history with a file for data storage.

Syntax

hist_filebase (hist_task, history, directory, basename, extension, numdigits)
    

Parameters

hist_task

The task object corresponding to the Cascade Historian. See locate_task in the Gamma manual.

history

The name of a history to be set or queried.

directory

A string containing the name of an existing directory, either absolute or relative to the directory in which histdb was started.

basename

A string containing the base file name, without an extension or directory.

extension

A string containing the file extension.

numdigits

An integer that specifies how the filename is augmented for multiple files, described in detail below.

Returns

t (true) if successful. Otherwise returns nil and sets _last_error_ to the error string returned by the Cascade Historian.

Description

This function associates a file with a history. Without an associated file, data received by the Cascade Historian will be lost when the buffer is full, or when the Cascade Historian is shut down. A history without a file (and with a sufficiently large buffer) could be used for temporary storage and analysis of data.

A history is potentially logged to multiple files. These can be numbered sequentially, or based on date, as specified by the numdigits parameter. The filename specified by the user is automatically augmented as each new file is opened, and the Cascade Historian understands that these files all belong together as a single history.

When filebase or HI_FileBase is first called for a history, it sets the pattern for all file names to be created for the history. Once this has been done, the Cascade Historian will be able to find the files relating to that history at any time, and will begin numbering from the next file number as necessary.

The possible values for the numdigits parameter, with their implications, are as follows:

    < 0 : Use the date to generate the unique suffix.

    = 0 : No sequential digits are added to the name. This is the default.

    > 0 : Specifies the number of decimal digits to be added to the filebase.

This function corresponds to the filebase command, and the Cogent C API function HI_Filebase.