DataServer

Bugfix in DataSeries
This commit is contained in:
Michael Schimmel
2025-06-06 23:24:08 +02:00
parent a6c0c3d6b3
commit 031b99acc8
11 changed files with 369 additions and 86 deletions
+14
View File
@@ -31,6 +31,7 @@ type
private
FMutable: IMutable;
function GetChanged: TSignal; inline;
function GetValue: T; inline;
{$ENDREGION}
public
constructor Create(const AMutable: IMutable);
@@ -44,6 +45,7 @@ type
class function CreateWriteable(const Init: T): IWriteable; overload; static;
property Value: T read GetValue;
property Changed: TSignal read GetChanged;
end;
@@ -74,6 +76,7 @@ type
class operator Implicit(const A: TLazy<T>): ILazy; overload;
class function Construct(const Changing: TSignal.ISignal; const Proc: TFunc<T>): TLazy<T>; overload; static;
class function Construct(const Mutable: TMutable<T>): TLazy<T>; overload; static;
class property Null: ILazy read FNull;
function Pop(out Res: T): Boolean; inline;
@@ -115,6 +118,11 @@ begin
Result := FMutable.Changed;
end;
function TMutable<T>.GetValue: T;
begin
Result := FMutable.Value;
end;
class operator TMutable<T>.Implicit(const A: TMutable<T>): IMutable;
begin
Result := A.FMutable;
@@ -149,6 +157,12 @@ begin
FNull := TMycNullLazy<T>.Create;
end;
class function TLazy<T>.Construct(const Mutable: TMutable<T>): TLazy<T>;
begin
var cap := Mutable;
Result := TMycFuncLazy<T>.Create(cap.Changed, function: T begin exit(Mutable.Value) end);
end;
function TLazy<T>.GetChanged: TState;
begin
Result := FLazy.Changed;