Preparing for atomic data values
This commit is contained in:
+43
-162
@@ -30,22 +30,11 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ILazy = interface
|
|
||||||
function GetKind: TDataValueKind;
|
|
||||||
function GetValue: TDataValue;
|
|
||||||
property Kind: TDataValueKind read GetKind;
|
|
||||||
property Value: TDataValue read GetValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TInternalKind = (vkLazy = Ord(High(TDataValueKind)) + 1);
|
|
||||||
TInternalKindOrdinal = 0..Ord(High(TInternalKind));
|
|
||||||
|
|
||||||
var
|
var
|
||||||
FKind: TInternalKindOrdinal;
|
FKind: TDataValueKind;
|
||||||
FScalar: TScalar;
|
FScalar: TScalar;
|
||||||
FInterface: IInterface;
|
FInterface: IInterface;
|
||||||
|
|
||||||
function AsLazy: ILazy; inline;
|
|
||||||
function GetKind: TDataValueKind; inline;
|
function GetKind: TDataValueKind; inline;
|
||||||
function GetIsVoid: Boolean; inline;
|
function GetIsVoid: Boolean; inline;
|
||||||
|
|
||||||
@@ -61,6 +50,9 @@ type
|
|||||||
class operator Implicit(const AValue: TDataValue.TFunc): TDataValue; overload; inline;
|
class operator Implicit(const AValue: TDataValue.TFunc): TDataValue; overload; inline;
|
||||||
class operator Implicit(const AValue: TObject): TDataValue; overload; inline;
|
class operator Implicit(const AValue: TObject): TDataValue; overload; inline;
|
||||||
|
|
||||||
|
class function CompareAndSet(var Target: TDataValue; const Expected, NewValue: TDataValue): Boolean; static;
|
||||||
|
class function Reset(var Target: TDataValue; const NewValue: TDataValue): TDataValue; static;
|
||||||
|
|
||||||
class function FromIntf<T: IInterface>(const AValue: T): TDataValue; static;
|
class function FromIntf<T: IInterface>(const AValue: T): TDataValue; static;
|
||||||
function AsIntf<T: IInterface>: T; inline;
|
function AsIntf<T: IInterface>: T; inline;
|
||||||
|
|
||||||
@@ -70,8 +62,6 @@ type
|
|||||||
class function FromPtr(const AValue: Pointer): TDataValue; static; inline;
|
class function FromPtr(const AValue: Pointer): TDataValue; static; inline;
|
||||||
function AsPtr: Pointer; inline;
|
function AsPtr: Pointer; inline;
|
||||||
|
|
||||||
class function Defer(const Value: TDataValue; const Calc: TFunc): TDataValue; overload; static;
|
|
||||||
|
|
||||||
class function Map(const SourceSeries: ISeries; const MapperFunc: TFunc): ISeries; static;
|
class function Map(const SourceSeries: ISeries; const MapperFunc: TFunc): ISeries; static;
|
||||||
|
|
||||||
class function FromRecordSeries(const AValue: IRecordSeries): TDataValue; static; inline;
|
class function FromRecordSeries(const AValue: IRecordSeries): TDataValue; static; inline;
|
||||||
@@ -102,27 +92,6 @@ uses
|
|||||||
TypInfo;
|
TypInfo;
|
||||||
|
|
||||||
type
|
type
|
||||||
TManagedLazy = class(TInterfacedObject, TDataValue.ILazy)
|
|
||||||
private
|
|
||||||
FKind: TDataValueKind;
|
|
||||||
FVal: IInterface;
|
|
||||||
FCalc: TDataValue.TFunc;
|
|
||||||
function GetValue: TDataValue;
|
|
||||||
function GetKind: TDataValueKind;
|
|
||||||
public
|
|
||||||
constructor Create(AKind: TDataValueKind; const AVal: IInterface; const ACalc: TDataValue.TFunc);
|
|
||||||
end;
|
|
||||||
|
|
||||||
TScalarLazy = class(TInterfacedObject, TDataValue.ILazy)
|
|
||||||
private
|
|
||||||
FVal: TScalar;
|
|
||||||
FCalc: TDataValue.TFunc;
|
|
||||||
function GetKind: TDataValueKind;
|
|
||||||
function GetValue: TDataValue;
|
|
||||||
public
|
|
||||||
constructor Create(const AVal: TScalar; const ACalc: TDataValue.TFunc);
|
|
||||||
end;
|
|
||||||
|
|
||||||
TMapSeries = class(TInterfacedObject, ISeries)
|
TMapSeries = class(TInterfacedObject, ISeries)
|
||||||
private
|
private
|
||||||
FSourceSeries: ISeries;
|
FSourceSeries: ISeries;
|
||||||
@@ -135,46 +104,6 @@ type
|
|||||||
constructor Create(const ASourceSeries: ISeries; const AMapperFunc: TDataValue.TFunc);
|
constructor Create(const ASourceSeries: ISeries; const AMapperFunc: TDataValue.TFunc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TManagedLazy.Create(AKind: TDataValueKind; const AVal: IInterface; const ACalc: TDataValue.TFunc);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FKind := AKind;
|
|
||||||
Assert(FKind <> vkVoid);
|
|
||||||
FVal := AVal;
|
|
||||||
FCalc := ACalc;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TManagedLazy.GetKind: TDataValueKind;
|
|
||||||
begin
|
|
||||||
Result := FKind;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TManagedLazy.GetValue: TDataValue;
|
|
||||||
var
|
|
||||||
dv: TDataValue;
|
|
||||||
begin
|
|
||||||
dv.FKind := Ord(FKind);
|
|
||||||
dv.FInterface := FVal;
|
|
||||||
Result := FCalc([dv]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TScalarLazy.Create(const AVal: TScalar; const ACalc: TDataValue.TFunc);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FVal := AVal;
|
|
||||||
FCalc := ACalc;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TScalarLazy.GetKind: TDataValueKind;
|
|
||||||
begin
|
|
||||||
Result := vkScalar;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TScalarLazy.GetValue: TDataValue;
|
|
||||||
begin
|
|
||||||
Result := FCalc([FVal]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TDataValue.TVal<T> }
|
{ TDataValue.TVal<T> }
|
||||||
|
|
||||||
constructor TDataValue.TVal<T>.Create(const AValue: T);
|
constructor TDataValue.TVal<T>.Create(const AValue: T);
|
||||||
@@ -186,43 +115,31 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsLazy: ILazy;
|
|
||||||
begin
|
|
||||||
Assert(FKind = Ord(vkLazy));
|
|
||||||
Result := ILazy(FInterface);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TDataValue }
|
{ TDataValue }
|
||||||
|
|
||||||
class operator TDataValue.Initialize(out Dest: TDataValue);
|
class operator TDataValue.Initialize(out Dest: TDataValue);
|
||||||
begin
|
begin
|
||||||
Dest.FKind := Ord(vkVoid);
|
Dest.FKind := vkVoid;
|
||||||
Dest.FInterface := nil;
|
Dest.FInterface := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsSeries: ISeries;
|
function TDataValue.AsSeries: ISeries;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkSeries) then
|
||||||
exit(AsLazy.Value.AsSeries);
|
|
||||||
if (FKind <> Ord(vkSeries)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as MemberSeries.');
|
raise EInvalidCast.Create('Cannot read value as MemberSeries.');
|
||||||
Result := ISeries(FInterface);
|
Result := ISeries(FInterface);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsMethod: TFunc;
|
function TDataValue.AsMethod: TFunc;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkMethod) then
|
||||||
exit(AsLazy.Value.AsMethod);
|
|
||||||
if (FKind <> Ord(vkMethod)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as a method.');
|
raise EInvalidCast.Create('Cannot read value as a method.');
|
||||||
Result := TFunc(FInterface);
|
Result := TFunc(FInterface);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsGeneric<T>: T;
|
function TDataValue.AsGeneric<T>: T;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if FKind <> vkGeneric then
|
||||||
exit(AsLazy.Value.AsGeneric<T>);
|
|
||||||
if FKind <> Ord(vkGeneric) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as generic of ' + String(PTypeInfo(TypeInfo(T)).Name) + '.');
|
raise EInvalidCast.Create('Cannot read value as generic of ' + String(PTypeInfo(TypeInfo(T)).Name) + '.');
|
||||||
{$ifdef DEBUG}
|
{$ifdef DEBUG}
|
||||||
if TVal<T>(FInterface).TypeHandle <> TypeInfo(T) then
|
if TVal<T>(FInterface).TypeHandle <> TypeInfo(T) then
|
||||||
@@ -233,155 +150,115 @@ end;
|
|||||||
|
|
||||||
function TDataValue.AsIntf<T>: T;
|
function TDataValue.AsIntf<T>: T;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if FKind <> vkInterface then
|
||||||
exit(AsLazy.Value.AsGeneric<T>);
|
|
||||||
if FKind <> Ord(vkInterface) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as interface.');
|
raise EInvalidCast.Create('Cannot read value as interface.');
|
||||||
Result := T(FInterface);
|
Result := T(FInterface);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsObject: TObject;
|
function TDataValue.AsObject: TObject;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkManagedObject) then
|
||||||
exit(AsLazy.Value.AsObject);
|
|
||||||
if (FKind <> Ord(vkManagedObject)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as object.');
|
raise EInvalidCast.Create('Cannot read value as object.');
|
||||||
Result := (FInterface as TObjVal).Value;
|
Result := (FInterface as TObjVal).Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsPtr: Pointer;
|
function TDataValue.AsPtr: Pointer;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkPointer) then
|
||||||
exit(AsLazy.Value.AsPtr);
|
|
||||||
if (FKind <> Ord(vkPointer)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as pointer.');
|
raise EInvalidCast.Create('Cannot read value as pointer.');
|
||||||
Result := Pointer(FScalar.Value.AsInt64);
|
Result := Pointer(FScalar.Value.AsInt64);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsRecord: TScalarRecord;
|
function TDataValue.AsRecord: TScalarRecord;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkRecord) then
|
||||||
exit(AsLazy.Value.AsRecord);
|
|
||||||
if (FKind <> Ord(vkRecord)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as Record.');
|
raise EInvalidCast.Create('Cannot read value as Record.');
|
||||||
Result := (FInterface as TVal<TScalarRecord>).Value;
|
Result := (FInterface as TVal<TScalarRecord>).Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsRecordSeries: IRecordSeries;
|
function TDataValue.AsRecordSeries: IRecordSeries;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkRecordSeries) then
|
||||||
exit(AsLazy.Value.AsRecordSeries);
|
|
||||||
if (FKind <> Ord(vkRecordSeries)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as RecordSeries.');
|
raise EInvalidCast.Create('Cannot read value as RecordSeries.');
|
||||||
Result := IRecordSeries(FInterface);
|
Result := IRecordSeries(FInterface);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsScalar: TScalar;
|
function TDataValue.AsScalar: TScalar;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkScalar) then
|
||||||
exit(AsLazy.Value.AsScalar);
|
|
||||||
if (FKind <> Ord(vkScalar)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as a Scalar.');
|
raise EInvalidCast.Create('Cannot read value as a Scalar.');
|
||||||
Result := FScalar;
|
Result := FScalar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.AsText: String;
|
function TDataValue.AsText: String;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
if (FKind <> vkText) then
|
||||||
exit(AsLazy.Value.AsText);
|
|
||||||
if (FKind <> Ord(vkText)) then
|
|
||||||
raise EInvalidCast.Create('Cannot read value as Text.');
|
raise EInvalidCast.Create('Cannot read value as Text.');
|
||||||
Result := (FInterface as TVal<String>).Value;
|
Result := (FInterface as TVal<String>).Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.Defer(const Value: TDataValue; const Calc: TFunc): TDataValue;
|
class function TDataValue.CompareAndSet(var Target: TDataValue; const Expected, NewValue: TDataValue): Boolean;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkLazy);
|
// Result := ;
|
||||||
case Value.FKind of
|
|
||||||
Ord(vkScalar): Result.FInterface := TScalarLazy.Create(Value.AsScalar, Calc);
|
|
||||||
Ord(vkLazy):
|
|
||||||
begin
|
|
||||||
// Create a new lazy object that wraps the existing one, passing the original
|
|
||||||
// kind and the inner lazy interface.
|
|
||||||
var cCalc: TFunc := Calc;
|
|
||||||
Result.FInterface :=
|
|
||||||
TManagedLazy.Create(
|
|
||||||
Value.AsLazy.Kind,
|
|
||||||
Value.FInterface,
|
|
||||||
function(const ArgNodes: TArray<TDataValue>): TDataValue
|
|
||||||
begin
|
|
||||||
// Chain lazy computations. The new calculation function will first evaluate
|
|
||||||
// the inner lazy value and then pass the result to the new calculation.
|
|
||||||
// The reconstructed TDataValue in ArgNodes[0] contains the inner ILazy interface.
|
|
||||||
Assert(Length(ArgNodes) = 1, 'Expected 1 argument in lazy computation chain');
|
|
||||||
Result := cCalc([ILazy(ArgNodes[0].FInterface).Value]);
|
|
||||||
end
|
|
||||||
);
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
Result.FInterface := TManagedLazy.Create(Value.Kind, Value.FInterface, Calc);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromIntf<T>(const AValue: T): TDataValue;
|
class function TDataValue.FromIntf<T>(const AValue: T): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkInterface);
|
Result.FKind := vkInterface;
|
||||||
Result.FInterface := IInterface(AValue);
|
Result.FInterface := IInterface(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromGeneric<T>(const [ref] AValue: T): TDataValue;
|
class function TDataValue.FromGeneric<T>(const [ref] AValue: T): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkGeneric);
|
Result.FKind := vkGeneric;
|
||||||
Result.FInterface := TVal<T>.Create(AValue);
|
Result.FInterface := TVal<T>.Create(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromPtr(const AValue: Pointer): TDataValue;
|
class function TDataValue.FromPtr(const AValue: Pointer): TDataValue;
|
||||||
begin
|
begin
|
||||||
Assert(sizeof(Pointer) <= sizeof(Int64));
|
Assert(sizeof(Pointer) <= sizeof(Int64));
|
||||||
Result.FKind := Ord(vkPointer);
|
Result.FKind := vkPointer;
|
||||||
Result.FScalar.FromInt64(Int64(AValue));
|
Result.FScalar.FromInt64(Int64(AValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromSeries(const AValue: ISeries): TDataValue;
|
class function TDataValue.FromSeries(const AValue: ISeries): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkSeries);
|
Result.FKind := vkSeries;
|
||||||
Result.FInterface := AValue;
|
Result.FInterface := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromRecord(const [ref] AValue: TScalarRecord): TDataValue;
|
class function TDataValue.FromRecord(const [ref] AValue: TScalarRecord): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkRecord);
|
Result.FKind := vkRecord;
|
||||||
Result.FInterface := TVal<TScalarRecord>.Create(AValue);
|
Result.FInterface := TVal<TScalarRecord>.Create(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TDataValue.FromRecordSeries(const AValue: IRecordSeries): TDataValue;
|
class function TDataValue.FromRecordSeries(const AValue: IRecordSeries): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkRecordSeries);
|
Result.FKind := vkRecordSeries;
|
||||||
Result.FInterface := AValue;
|
Result.FInterface := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: TScalar): TDataValue;
|
class operator TDataValue.Implicit(const AValue: TScalar): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkScalar);
|
Result.FKind := vkScalar;
|
||||||
Result.FScalar := AValue;
|
Result.FScalar := AValue;
|
||||||
Result.FInterface := nil;
|
Result.FInterface := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: String): TDataValue;
|
class operator TDataValue.Implicit(const AValue: String): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkText);
|
Result.FKind := vkText;
|
||||||
Result.FInterface := TVal<String>.Create(AValue);
|
Result.FInterface := TVal<String>.Create(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.GetIsVoid: Boolean;
|
function TDataValue.GetIsVoid: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FKind = Ord(vkVoid);
|
Result := FKind = vkVoid;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataValue.GetKind: TDataValueKind;
|
function TDataValue.GetKind: TDataValueKind;
|
||||||
begin
|
begin
|
||||||
if FKind = Ord(vkLazy) then
|
|
||||||
exit(AsLazy.Kind);
|
|
||||||
Result := TDataValueKind(FKind);
|
Result := TDataValueKind(FKind);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -390,6 +267,11 @@ begin
|
|||||||
Result := TMapSeries.Create(SourceSeries, MapperFunc);
|
Result := TMapSeries.Create(SourceSeries, MapperFunc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TDataValue.Reset(var Target: TDataValue; const NewValue: TDataValue): TDataValue;
|
||||||
|
begin
|
||||||
|
// Result := ;
|
||||||
|
end;
|
||||||
|
|
||||||
function TDataValue.ToString: String;
|
function TDataValue.ToString: String;
|
||||||
var
|
var
|
||||||
sb: TStringBuilder;
|
sb: TStringBuilder;
|
||||||
@@ -397,15 +279,15 @@ var
|
|||||||
first: Boolean;
|
first: Boolean;
|
||||||
begin
|
begin
|
||||||
case FKind of
|
case FKind of
|
||||||
Ord(vkScalar): Result := FScalar.ToString;
|
vkScalar: Result := FScalar.ToString;
|
||||||
Ord(vkText): Result := '"' + AsText + '"';
|
vkText: Result := '"' + AsText + '"';
|
||||||
Ord(vkSeries):
|
vkSeries:
|
||||||
begin
|
begin
|
||||||
var series := AsSeries;
|
var series := AsSeries;
|
||||||
// Add type and count for series
|
// Add type and count for series
|
||||||
Result := Format('<series[%d]>', [series.Count]);
|
Result := Format('<series[%d]>', [series.Count]);
|
||||||
end;
|
end;
|
||||||
Ord(vkRecordSeries):
|
vkRecordSeries:
|
||||||
begin
|
begin
|
||||||
var series := AsRecordSeries;
|
var series := AsRecordSeries;
|
||||||
sb := TStringBuilder.Create;
|
sb := TStringBuilder.Create;
|
||||||
@@ -426,7 +308,7 @@ begin
|
|||||||
sb.Free;
|
sb.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Ord(vkRecord):
|
vkRecord:
|
||||||
begin
|
begin
|
||||||
var rec := AsRecord;
|
var rec := AsRecord;
|
||||||
sb := TStringBuilder.Create;
|
sb := TStringBuilder.Create;
|
||||||
@@ -447,13 +329,12 @@ begin
|
|||||||
sb.Free;
|
sb.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Ord(vkVoid): Result := '<void>';
|
vkVoid: Result := '<void>';
|
||||||
Ord(vkMethod): Result := '<method>';
|
vkMethod: Result := '<method>';
|
||||||
Ord(vkGeneric):
|
vkGeneric:
|
||||||
// Getting meaningful type information for vkGeneric is not easily possible
|
// Getting meaningful type information for vkGeneric is not easily possible
|
||||||
// without storing additional RTTI, as the specific type of T in TVal<T> is lost.
|
// without storing additional RTTI, as the specific type of T in TVal<T> is lost.
|
||||||
Result := '<generic>';
|
Result := '<generic>';
|
||||||
Ord(vkLazy): Result := Format('<lazy[%s]>', [AsLazy.Kind.ToString]);
|
|
||||||
else
|
else
|
||||||
Result := '[Unknown DataValue]';
|
Result := '[Unknown DataValue]';
|
||||||
end;
|
end;
|
||||||
@@ -466,13 +347,13 @@ end;
|
|||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: TDataValue.TFunc): TDataValue;
|
class operator TDataValue.Implicit(const AValue: TDataValue.TFunc): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkMethod);
|
Result.FKind := vkMethod;
|
||||||
TFunc(Result.FInterface) := AValue;
|
TFunc(Result.FInterface) := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: TObject): TDataValue;
|
class operator TDataValue.Implicit(const AValue: TObject): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkManagedObject);
|
Result.FKind := vkManagedObject;
|
||||||
Result.FInterface := TObjVal.Create(AValue);
|
Result.FInterface := TObjVal.Create(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -483,14 +364,14 @@ end;
|
|||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: Int64): TDataValue;
|
class operator TDataValue.Implicit(const AValue: Int64): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkScalar);
|
Result.FKind := vkScalar;
|
||||||
Result.FScalar := TScalar.FromInt64(AValue);
|
Result.FScalar := TScalar.FromInt64(AValue);
|
||||||
Result.FInterface := nil;
|
Result.FInterface := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class operator TDataValue.Implicit(const AValue: Double): TDataValue;
|
class operator TDataValue.Implicit(const AValue: Double): TDataValue;
|
||||||
begin
|
begin
|
||||||
Result.FKind := Ord(vkScalar);
|
Result.FKind := vkScalar;
|
||||||
Result.FScalar := TScalar.FromDouble(AValue);
|
Result.FScalar := TScalar.FromDouble(AValue);
|
||||||
Result.FInterface := nil;
|
Result.FInterface := nil;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user