FB_BA_PersistentKeyValueFile

The FB_BA_PersistentKeyValueFile provides built-in data handling for persistent data in key-value pair format.
File format
Any number of data records can be represented as key-value pairs:

The file path ends with the extension *.psd, *.kv, or *.csv.
Workflow
Write
- Start the writing process
FB_BA_PersistentKeyValueFile.bWrite := TRUE;
The callback I_BA_PersistentKeyValueFileProvider.WriteData() is called. - Write records
I_BA_KeyValueFileWriter.WriteRecord(); - Finish the write operation
The callback I_BA_PersistentKeyValueFileProvider.WriteData() returns TRUE.

Read
- Start the reading process
FB_BA_PersistentKeyValueFile.bRead := TRUE;
The callback I_BA_PersistentKeyValueFileProvider.ReadData() is called. - Read Key-Value Pairs
- Read key:
I_BA_KeyValueFileReader.ReadKey(); - Read value:
Reading using I_BA_KeyValueFileReader.ReadValue();
Skip using I_BA_KeyValueFileReader.SkipValue(); - Stop reading
The callback I_BA_PersistentKeyValueFileProvider.ReadData() returns TRUE.

Inherits from: FB_BA_PersistentCsvFile
Implemented: I_BA_KeyValueFileWriter, I_BA_KeyValueFileReader
Syntax
FUNCTION_BLOCK FB_BA_PersistentKeyValueFile EXTENDS FB_BA_PersistentCsvFile IMPLEMENTS I_BA_KeyValueFileWriter, I_BA_KeyValueFileReader
VAR_INPUT CONSTANT
{region 'Settings'}
iOwner : I_BA_PersistentKeyValueFileProvider;
{endregion}
END_VAR
Inputs CONSTANT
Name | Type | Description |
|---|---|---|
iOwner | Interface to the source of the files to be read and written. |