Stages

Let us now see how the stages are implemented. The first stage, FolderScanner, scans a folder and writes all found Pascal files to the output. Its implementation is shown as follows.

The stage method receives two parameters of type IOmniBlockingCollection, which represent its input and output communication channel, and an optional parameter that allows access to the task that runs the stage code (task: IOmniTask).

An IOmniBlockingCollection channel contains items of type TOmniValue, which is a fast variation of Delphi's Variant or TValue. This type can store any other Delphi data type inside.

A typical stage would run a for value in input loop to read all the data from the input. This for doesn't exit if there is no data on the input ...

Get Mastering Delphi Programming: A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.