Refactoring

This commit is contained in:
Michael Schimmel
2025-06-03 18:20:02 +02:00
parent 561a3c6bb5
commit 556690fa5e
12 changed files with 152 additions and 155 deletions
+9 -9
View File
@@ -10,23 +10,23 @@ type
TMycFuture<T> = class abstract( TInterfacedObject, IMycFuture<T> )
protected
function GetResult: T; virtual; abstract;
function GetDone: IMycState; virtual; abstract;
function GetDone: TState; virtual; abstract;
end;
TMycNullFuture<T> = class( TMycFuture<T> )
protected
function GetResult: T; override;
function GetDone: IMycState; override;
function GetDone: TState; override;
end;
TMycGateFuncFuture<T> = class(TMycFuture<T>)
TMycGateFuncFuture<T> = class( TMycFuture<T> )
private
FInit: TMycSubscription;
FInit: TState.TSubscription;
FDone: IMycLatch;
FResult: T;
protected
function GetResult: T; override;
function GetDone: IMycState; override;
function GetDone: TState; override;
public
constructor Create( const ATaskManager: IMycTaskManager; const AGate: IMycState; AProc: TFunc<T> );
destructor Destroy; override;
@@ -36,19 +36,19 @@ implementation
{ TMycNullFuture<T> }
function TMycNullFuture<T>.GetDone: IMycState;
function TMycNullFuture<T>.GetDone: TState;
begin
Result := TState.Null;
end;
function TMycNullFuture<T>.GetResult: T;
begin
Result := Default(T);
Result := Default ( T );
end;
{ TMycGateFuncFuture<T> }
constructor TMycGateFuncFuture<T>.Create(const ATaskManager: IMycTaskManager; const AGate: IMycState; AProc: TFunc<T>);
constructor TMycGateFuncFuture<T>.Create( const ATaskManager: IMycTaskManager; const AGate: IMycState; AProc: TFunc<T> );
begin
inherited Create;
@@ -81,7 +81,7 @@ begin
inherited Destroy;
end;
function TMycGateFuncFuture<T>.GetDone: IMycState;
function TMycGateFuncFuture<T>.GetDone: TState;
begin
Result := FDone.State;
end;