Streamlining dataflow
This commit is contained in:
@@ -177,12 +177,10 @@ type
|
||||
{$region 'private'}
|
||||
function GetCount: Int64;
|
||||
function GetItems(Idx: Integer): TScalar;
|
||||
function GetKind: TScalarKind;
|
||||
function GetTotalCount: Int64;
|
||||
{$endregion}
|
||||
property Count: Int64 read GetCount;
|
||||
property Items[Idx: Integer]: TScalar read GetItems; default;
|
||||
property Kind: TScalarKind read GetKind;
|
||||
property TotalCount: Int64 read GetTotalCount;
|
||||
end;
|
||||
|
||||
@@ -197,7 +195,6 @@ type
|
||||
FArray: TChunkArray<TScalarValue>;
|
||||
FTotalCount: Int64;
|
||||
|
||||
function GetKind: TScalarKind; inline;
|
||||
function GetCount: Int64; inline;
|
||||
function GetItems(Idx: Integer): TScalar; inline;
|
||||
function GetTotalCount: Int64; inline;
|
||||
@@ -232,7 +229,6 @@ type
|
||||
FOffset: Integer;
|
||||
function GetCount: Int64;
|
||||
function GetItems(Idx: Integer): TScalar;
|
||||
function GetKind: TScalarKind;
|
||||
function GetTotalCount: Int64;
|
||||
public
|
||||
constructor Create(ARecordSeries: TScalarRecordSeries; AElementIdx: Integer);
|
||||
@@ -1524,11 +1520,6 @@ begin
|
||||
Result.Create(FKind, P^);
|
||||
end;
|
||||
|
||||
function TScalarRecordSeries.TMemberSeries.GetKind: TScalarKind;
|
||||
begin
|
||||
Result := FKind;
|
||||
end;
|
||||
|
||||
function TScalarRecordSeries.TMemberSeries.GetTotalCount: Int64;
|
||||
begin
|
||||
Result := FRecordSeries.TotalCount;
|
||||
@@ -1561,11 +1552,6 @@ begin
|
||||
Result.Create(FKind, FArray[FArray.Count - Idx - 1]);
|
||||
end;
|
||||
|
||||
function TScalarSeries.GetKind: TScalarKind;
|
||||
begin
|
||||
Result := FKind;
|
||||
end;
|
||||
|
||||
function TScalarSeries.GetTotalCount: Int64;
|
||||
begin
|
||||
Result := FTotalCount;
|
||||
|
||||
@@ -8,7 +8,7 @@ uses
|
||||
Myc.Data.Series;
|
||||
|
||||
type
|
||||
TDataValueKind = (vkVoid, vkScalar, vkText, vkSeries, vkRecordSeries, vkRecord, vkMemberSeries, vkMethod, vkGeneric);
|
||||
TDataValueKind = (vkVoid, vkScalar, vkText, vkSeries, vkRecordSeries, vkRecord, vkMethod, vkGeneric);
|
||||
|
||||
TDataValue = record
|
||||
type
|
||||
@@ -63,18 +63,16 @@ type
|
||||
|
||||
class function Defer(const Value: TDataValue; const Calc: TFunc): TDataValue; overload; static;
|
||||
|
||||
class function FromSeries(const AValue: IWriteableSeries): TDataValue; static; inline;
|
||||
class function FromRecordSeries(const AValue: IRecordSeries): TDataValue; static; inline;
|
||||
class function FromRecord(const [ref] AValue: TScalarRecord): TDataValue; static; inline;
|
||||
class function FromMemberSeries(const AValue: ISeries): TDataValue; static; inline;
|
||||
class function FromSeries(const AValue: ISeries): TDataValue; static; inline;
|
||||
|
||||
function AsScalar: TScalar; inline;
|
||||
function AsMethod: TFunc; inline;
|
||||
function AsText: String; inline;
|
||||
function AsRecordSeries: IRecordSeries; inline;
|
||||
function AsRecord: TScalarRecord; inline;
|
||||
function AsMemberSeries: ISeries; inline;
|
||||
function AsSeries: IWriteableSeries; inline;
|
||||
function AsSeries: ISeries; inline;
|
||||
|
||||
function ToString: String;
|
||||
property IsVoid: Boolean read GetIsVoid;
|
||||
@@ -186,11 +184,11 @@ begin
|
||||
Dest.FInterface := nil;
|
||||
end;
|
||||
|
||||
function TDataValue.AsMemberSeries: ISeries;
|
||||
function TDataValue.AsSeries: ISeries;
|
||||
begin
|
||||
if FKind = Ord(vkLazy) then
|
||||
exit(AsLazy.Value.AsMemberSeries);
|
||||
if (FKind <> Ord(vkMemberSeries)) then
|
||||
exit(AsLazy.Value.AsSeries);
|
||||
if (FKind <> Ord(vkSeries)) then
|
||||
raise EInvalidCast.Create('Cannot read value as MemberSeries.');
|
||||
Result := ISeries(FInterface);
|
||||
end;
|
||||
@@ -244,15 +242,6 @@ begin
|
||||
Result := FScalar;
|
||||
end;
|
||||
|
||||
function TDataValue.AsSeries: IWriteableSeries;
|
||||
begin
|
||||
if FKind = Ord(vkLazy) then
|
||||
exit(AsLazy.Value.AsSeries);
|
||||
if (FKind <> Ord(vkSeries)) then
|
||||
raise EInvalidCast.Create('Cannot read value as Series.');
|
||||
Result := IWriteableSeries(FInterface);
|
||||
end;
|
||||
|
||||
function TDataValue.AsText: String;
|
||||
begin
|
||||
if FKind = Ord(vkLazy) then
|
||||
@@ -297,9 +286,9 @@ begin
|
||||
Result.FInterface := TVal<T>.Create(AValue);
|
||||
end;
|
||||
|
||||
class function TDataValue.FromMemberSeries(const AValue: ISeries): TDataValue;
|
||||
class function TDataValue.FromSeries(const AValue: ISeries): TDataValue;
|
||||
begin
|
||||
Result.FKind := Ord(vkMemberSeries);
|
||||
Result.FKind := Ord(vkSeries);
|
||||
Result.FInterface := AValue;
|
||||
end;
|
||||
|
||||
@@ -315,12 +304,6 @@ begin
|
||||
Result.FInterface := AValue;
|
||||
end;
|
||||
|
||||
class function TDataValue.FromSeries(const AValue: IWriteableSeries): TDataValue;
|
||||
begin
|
||||
Result.FKind := Ord(vkSeries);
|
||||
Result.FInterface := AValue;
|
||||
end;
|
||||
|
||||
class operator TDataValue.Implicit(const AValue: TScalar): TDataValue;
|
||||
begin
|
||||
Result.FKind := Ord(vkScalar);
|
||||
@@ -359,7 +342,7 @@ begin
|
||||
begin
|
||||
var series := AsSeries;
|
||||
// Add type and count for series
|
||||
Result := Format('<series<%s>[%d]>', [series.Kind.ToString, series.Count]);
|
||||
Result := Format('<series[%d]>', [series.Count]);
|
||||
end;
|
||||
Ord(vkRecordSeries):
|
||||
begin
|
||||
@@ -403,12 +386,6 @@ begin
|
||||
sb.Free;
|
||||
end;
|
||||
end;
|
||||
Ord(vkMemberSeries):
|
||||
begin
|
||||
var series := AsMemberSeries;
|
||||
// Add type and count for member series
|
||||
Result := Format('<member_series<%s>[%d]>', [series.Kind.ToString, series.Count]);
|
||||
end;
|
||||
Ord(vkVoid): Result := '<void>';
|
||||
Ord(vkMethod): Result := '<method>';
|
||||
Ord(vkGeneric):
|
||||
@@ -447,7 +424,6 @@ begin
|
||||
vkSeries: Result := 'Series';
|
||||
vkRecordSeries: Result := 'RecordSeries';
|
||||
vkRecord: Result := 'Record';
|
||||
vkMemberSeries: Result := 'MemberSeries';
|
||||
vkMethod: Result := 'Method';
|
||||
else
|
||||
Result := 'unknown';
|
||||
|
||||
Reference in New Issue
Block a user