Refactoring
This commit is contained in:
+15
-8
@@ -22,20 +22,23 @@ type
|
||||
property Done: TState read GetDone;
|
||||
end;
|
||||
|
||||
private
|
||||
FFuture: IFuture;
|
||||
function GetDone: TState.IState; inline;
|
||||
function GetResult: T; inline;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: IFuture;
|
||||
|
||||
class constructor CreateClass;
|
||||
class destructor DestroyClass;
|
||||
|
||||
private
|
||||
FFuture: IFuture;
|
||||
function GetDone: TState; inline;
|
||||
function GetResult: T; inline;
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const AFuture: IFuture);
|
||||
|
||||
class operator Initialize(out Dest: TFuture<T>);
|
||||
class operator Implicit(const A: IFuture): TFuture<T>; overload;
|
||||
class operator Implicit(const A: TFuture<T>): IFuture; overload;
|
||||
|
||||
@@ -45,10 +48,9 @@ type
|
||||
class property Null: IFuture read FNull;
|
||||
|
||||
function Chain<S>(const Proc: TFunc<T, S>): TFuture<S>;
|
||||
|
||||
function WaitFor: T;
|
||||
|
||||
property Done: TState.IState read GetDone;
|
||||
property Done: TState read GetDone;
|
||||
property Result: T read GetResult;
|
||||
end;
|
||||
|
||||
@@ -93,7 +95,7 @@ begin
|
||||
Result := TMycGateFuncFuture<T>.Create(TaskManager, Gate, Proc);
|
||||
end;
|
||||
|
||||
function TFuture<T>.GetDone: TState.IState;
|
||||
function TFuture<T>.GetDone: TState;
|
||||
begin
|
||||
Result := FFuture.Done;
|
||||
end;
|
||||
@@ -119,4 +121,9 @@ begin
|
||||
Result := A.FFuture;
|
||||
end;
|
||||
|
||||
class operator TFuture<T>.Initialize(out Dest: TFuture<T>);
|
||||
begin
|
||||
Dest.FFuture := FNull;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
+10
-4
@@ -30,6 +30,7 @@ type
|
||||
procedure Unsubscribe;
|
||||
end;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: ISignal;
|
||||
@@ -37,7 +38,7 @@ type
|
||||
|
||||
private
|
||||
FSignal: ISignal;
|
||||
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const ASignal: ISignal);
|
||||
class operator Initialize(out Dest: TSignal);
|
||||
@@ -55,6 +56,7 @@ type
|
||||
procedure Trigger;
|
||||
end;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: IEvent;
|
||||
@@ -62,7 +64,7 @@ type
|
||||
|
||||
private
|
||||
FEvent: IEvent;
|
||||
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const AEvent: IEvent);
|
||||
class operator Initialize(out Dest: TEvent);
|
||||
@@ -85,6 +87,7 @@ type
|
||||
property IsSet: Boolean read GetIsSet;
|
||||
end;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: IState;
|
||||
@@ -93,7 +96,7 @@ type
|
||||
private
|
||||
FState: IState;
|
||||
function GetIsSet: Boolean; inline;
|
||||
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const AState: IState);
|
||||
class operator Initialize(out Dest: TState);
|
||||
@@ -120,6 +123,7 @@ type
|
||||
property State: TState read GetState;
|
||||
end;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: ILatch;
|
||||
@@ -128,7 +132,7 @@ type
|
||||
private
|
||||
FLatch: ILatch;
|
||||
function GetState: TState; inline;
|
||||
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const ALatch: ILatch);
|
||||
class operator Initialize(out Dest: TLatch);
|
||||
@@ -155,6 +159,7 @@ type
|
||||
property State: TState read GetState;
|
||||
end;
|
||||
|
||||
{$REGION 'private'}
|
||||
strict private
|
||||
class var
|
||||
FNull: IFlag;
|
||||
@@ -164,6 +169,7 @@ type
|
||||
FDirty: IFlag;
|
||||
function GetState: TState; inline;
|
||||
|
||||
{$ENDREGION}
|
||||
public
|
||||
constructor Create(const ADirty: IFlag);
|
||||
class operator Initialize(out Dest: TFlag);
|
||||
|
||||
Reference in New Issue
Block a user