Data pipeline refactoring
This commit is contained in:
@@ -179,23 +179,27 @@ type
|
||||
procedure Add(const Item: TScalar.TValue; Lookback: Int64 = -1);
|
||||
end;
|
||||
|
||||
IRecordSeries = interface
|
||||
IScalarRecordSeries = interface
|
||||
{$region 'private'}
|
||||
function GetCount: Int64;
|
||||
function GetDef: IScalarRecordDefinition;
|
||||
function GetTotalCount: Int64;
|
||||
function GetFields(const Key: IKeyword): ISeries;
|
||||
function GetTotalCount: Int64;
|
||||
{$endregion}
|
||||
procedure Add(const Item: IScalarRecord; Lookback: Int64 = -1);
|
||||
procedure AddRaw(const Data; Lookback: Int64 = -1);
|
||||
property Count: Int64 read GetCount;
|
||||
property Def: IScalarRecordDefinition read GetDef;
|
||||
property Fields[const Key: IKeyword]: ISeries read GetFields; default;
|
||||
property TotalCount: Int64 read GetTotalCount;
|
||||
end;
|
||||
|
||||
IWriteableScalarRecordSeries = interface(IScalarRecordSeries)
|
||||
{$region 'private'}
|
||||
{$endregion}
|
||||
procedure Add(const Item: IScalarRecord; Lookback: Int64 = -1);
|
||||
end;
|
||||
|
||||
// A series of scalar records, optimized for memory and access speed.
|
||||
TScalarRecordSeries = class(TInterfacedObject, IRecordSeries)
|
||||
TScalarRecordSeries = class(TInterfacedObject, IWriteableScalarRecordSeries)
|
||||
type
|
||||
TMemberSeries = class(TGenericContainedObject<TScalarRecordSeries>, ISeries)
|
||||
private
|
||||
@@ -222,10 +226,8 @@ type
|
||||
public
|
||||
constructor Create(const ADef: IScalarRecordDefinition);
|
||||
destructor Destroy; override;
|
||||
procedure Add(const Item: IScalarRecord; Lookback: Int64 = -1);
|
||||
|
||||
// Copies data directly from the Data reference (zero-copy wrapper)
|
||||
procedure AddRaw(const Data; Lookback: Int64 = -1);
|
||||
procedure Add(const Item: IScalarRecord; Lookback: Int64 = -1);
|
||||
|
||||
property Count: Int64 read GetCount;
|
||||
property Fields[const Key: IKeyword]: ISeries read GetFields; default;
|
||||
@@ -809,18 +811,6 @@ begin
|
||||
inc(FTotalCount);
|
||||
end;
|
||||
|
||||
procedure TScalarRecordSeries.AddRaw(const Data; Lookback: Int64 = -1);
|
||||
begin
|
||||
var lb := FDef.Count * Integer(Lookback);
|
||||
var P: TScalar.PValue := @Data;
|
||||
for var i := 0 to FDef.Count - 1 do
|
||||
begin
|
||||
FArray.Add(P^, lb);
|
||||
inc(P);
|
||||
end;
|
||||
inc(FTotalCount);
|
||||
end;
|
||||
|
||||
function TScalarRecordSeries.GetFields(const Key: IKeyword): ISeries;
|
||||
begin
|
||||
var elem := FDef.IndexOf(Key);
|
||||
|
||||
Reference in New Issue
Block a user