Skip to main content

Delphi implementation

The Delphi implementation is the reference implementation of the Open Streaming Format: a complete read and write path for OSF4 and OSF5, a set of demos, and the osftool command line. It also produces the set of reference files the other implementations are checked against. Built with RAD Studio 23.0 (Delphi 12).

Library

The library units live under implementations/delphi/src/. The most important public building blocks:

UnitContents
OSF.TypesData and channel types (TOSFDataType, TOSFVersion, TOSFGpsLocation) and helper functions
OSF.FilerTOSFFile — streaming reader/writer for OSF4 and OSF5; transparent OSFZ decompression; OSF4 XML parsing via OmniXML (no MSXML dependency)
OSF.Data.ManagerTOSFDataManager — high-level read, populates typed channels; access by name
OSF.Data.Channelstyped in-memory channels incl. equidistant segments (each bcStartData opens a segment)
OSF.Logprocess-wide logging/progress dispatcher (Logger: TOSFLog) with a listener pattern (DECISIONS §22)
OSF.Export.CSV / OSF.Export.CSV.UnifiedCSV export — per channel (XY) and shared timeline respectively
OSF.Export.HDF5HDF5 export (Windows; one compressed compound dataset per channel)
OSF.MergerTOSFMerger — merge several OSF files over a time interval into one output file
OSF.Meta.Cachesidecar .json cache per OSF file (time ranges, sample counts) for fast metadata

A no-form program OSFCompileCheck.dpr in the implementation root covers every library unit via uses and gives a clean compile signal after refactorings.

Logging architecture

Every library unit writes log and progress events to the global Logger: TOSFLog. Applications register a TLoggerListener (with its own MinLevel and event callbacks); the singleton handles the fan-out. Details in DECISIONS §22.

Demos

Under implementations/delphi/demos/:

DemoPurpose
osfviewer/load an OSF file, list channels, render one channel as a TeeChart (IDE only)
osfgenerator/writes the 17-file reference set; the console variant OSFGeneratorCLI produces it non-interactively
osfcsvexport/pipeline demo TOSFFileTOSFDataManager → CSV export
osfmerger/VCL front-end for TOSFMerger (Win64)

Command line: osftool

osftool is the verb-based command-line tool of the Delphi implementation (Win64) with nine verbs — merge, export, info, channels, stat, cache, config, convert, verify.

The full description is in its own chapter osftool.

Building

The library and most demos are compiled with dcc32 (Win32) or dcc64 (Win64) from the respective project directory — osfmerger and osftool as Win64. Example (compile check):

cd implementations\delphi
dcc32 -B -Q OSFCompileCheck.dpr

The HDF5 export needs hdf5.dll at runtime; the binding (src/hdf5/) is a standalone, OSF-independent Delphi binding to the HDF5 C library.

Source code and further reading