DataServer 1st Version
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
unit Myc.Trade.DataServer;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
System.Generics.Collections,
|
||||
Myc.Lazy,
|
||||
Myc.Trade.DataPoint,
|
||||
Myc.Trade.DataSeries;
|
||||
|
||||
type
|
||||
IDataProvider = interface
|
||||
['{B2A9996C-724B-4416-A882-595B7E58066D}']
|
||||
procedure Fetch;
|
||||
end;
|
||||
|
||||
IDataServer<T> = interface
|
||||
['{A6E246A2-E84E-49AB-A63E-333E561E488C}']
|
||||
function GetData: TMutable<TArray<T>>;
|
||||
function GetIsLiveData: TMutable<Boolean>;
|
||||
property Data: TMutable<TArray<T>> read GetData;
|
||||
property IsLiveData: TMutable<Boolean> read GetIsLiveData;
|
||||
end;
|
||||
|
||||
TDataServer<T> = class(TInterfacedObject, IDataServer<T>, IDataProvider)
|
||||
protected
|
||||
function GetData: TMutable<TArray<T>>; virtual; abstract;
|
||||
function GetIsLiveData: TMutable<Boolean>; virtual; abstract;
|
||||
procedure Fetch; virtual; abstract;
|
||||
end;
|
||||
|
||||
IDataServerNode<T> = interface
|
||||
['{DA3531F1-158E-4A63-8E5A-34089C537B1B}']
|
||||
function CreateDataServer: IDataServer<T>;
|
||||
end;
|
||||
|
||||
TDataServerNode<T> = class(TInterfacedObject, IDataServerNode<T>)
|
||||
public
|
||||
// Factory method to create the actual data server instance.
|
||||
function CreateDataServer: IDataServer<T>; virtual; abstract;
|
||||
end;
|
||||
|
||||
TFileStreamServerNode<T> = class(TDataServerNode<T>)
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user