Refactoring
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user