Data Types

This commit is contained in:
Michael Schimmel
2025-08-25 10:26:48 +02:00
parent 75675b8dc1
commit 27f1cc5486
20 changed files with 2670 additions and 34 deletions
+14 -6
View File
@@ -118,7 +118,10 @@ type
class function CreateEndpoint<T>(Lookback: Int64; out Series: TLazy<TSeries<T>>): IConsumer<T>; static;
class function Join<T>(const Producers: TArray<TProducer<T>>): TProducer<TArray<T>>; static;
type
TJoinMode = (jmAll, jmAny);
class function Join<T>(Mode: TJoinMode; const Producers: TArray<TProducer<T>>): TProducer<TArray<T>>; static;
type
TRecordMapping = record
@@ -344,11 +347,16 @@ begin
);
end;
class function TConverter.Join<T>(const Producers: TArray<TProducer<T>>): TProducer<TArray<T>>;
class function TConverter.Join<T>(Mode: TJoinMode; const Producers: TArray<TProducer<T>>): TProducer<TArray<T>>;
var
joiner: TMycDataJoin<T>;
joiner: IDataJoin<T>;
begin
joiner := TMycDataJoin<T>.Create(Length(Producers));
case Mode of
jmAll: joiner := TMycDataJoinAll<T>.Create(Length(Producers));
jmAny: joiner := TMycDataJoinAny<T>.Create(Length(Producers));
else
Assert(false);
end;
Result := joiner;
for var i := 0 to High(Producers) do
@@ -361,7 +369,7 @@ class function TConverter.JoinRecords(
const Producers: TArray<TProducer<TDataRecord>>
): TConverter<TArray<TDataRecord>, TDataRecord>;
begin
var RecProvider := Join<TDataRecord>(Producers);
var RecProvider := Join<TDataRecord>(jmAll, Producers);
Result := DataMapping(Mapping, TargetLayout);
@@ -395,7 +403,7 @@ function TDataRecordHelper.JoinRecords(
begin
var map := TConverter.DataMapping(Mapping, TargetLayout);
TConverter.Join<TDataRecord>(Self).Chain(map.Consumer);
TConverter.Join<TDataRecord>(jmAll, Self).Chain(map.Consumer);
Result := map.Producer;
end;