Streaming

Description

sealed class Tinman.Terrain.Util.Streaming<T ref>

Derived from

Disposable abstract

The Streaming class performs incremental streaming of sequenced data.

Data is streamed from a sequence of data frames:

+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |...| N |   N = Count - 1
+---+---+---+---+---+---+---+---+---+---+
  [...........|.......................]     Index  = [0..N]
\_____________|________________/            Window = 8
    \______/  |                             Before = 2
              | \__________/                After  = 3
              |
            Frame = floor(Index)

Index depicts the target position for streaming.

Public / Constructors

Streaming


public constructor Streaming → (5)

source in : IStreamingSource<T>

[not-null]
The streaming source to use.

target in : IStreamingTarget<T> own

[not-null]
The streaming target to use.

before opt : int32 = 2

[>=0]
The number of pre-loaded data frames to keep before Frame.

after opt : int32 = 3

[>=0]
The number of pre-loaded data frames to keep after Frame.

index opt : float64 = 0

The initial data index, see Index.

Creates a new instance of Streaming.

The sum of before opt and after opt plus one must not be greater than IStreamingSource.Count of source in and should be smaller, to allow the target data frame index to move within a certain region without triggering streaming I/O work.

Public / Methods

Update


public method Update → (1)

force in : bool

true to wait for all data to finish loading,
false to load data in the background.

returns → bool

true if new data is available in at least one streaming window slot,
false if no new data is available.

Updates the streaming target

Public / Attributes

After


[Constant]
public attribute After → (get)

value : int32

[>=0]
The number of pre-loaded frames.

The number of pre-loaded data frames to keep after Frame.

Before


[Constant]
public attribute Before → (get)

value : int32

[>=0]
The number of pre-loaded frames.

The number of pre-loaded data frames to keep before Frame.

Count


[Constant]
public attribute Count → (get)

value : int32

[>=1]
The data frame count.

The number of data frames in the streaming source.

First


public attribute First → (get)

value : int32

[-1..Streaming.Window-1]
The data frame index or -1 iff Range is empty.

Returns the index of the streaming window slot that corresponds to RangeI.Start of Range.

Frame


public attribute Frame → (get)

value : int32

[0..Streaming.Count-1]
The current target data frame index.

The current target data frame index.

While streaming is keeping up, the target data frame index will be contained in Range. Otherwise, the target data frame is not available yet.

See also

Streaming.Index

Index


public attribute Index → (get,set)

value : float64

The current data index. Will be clamped to [0..Count-1].

The current data index.

Settings the data index will also update the target data frame index (see Index), which is defined as Maths.Floor1 of value in.

Range


public attribute Range → (get)

value : RangeI

The data frame index range. Will be empty (see RangeI.IsEmpty) iff no data has been loaded into the streaming window yet.

Returns the index range of the data frames that are present in the streaming window.

See also

Streaming.First

Window


public attribute Window → (get)

value : int32

[>=1]
The streaming window size.

The size of the streaming window.