Scalar 64bit decimal type
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
unit Myc.Data.POD;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Myc.Data.Series;
|
||||
|
||||
type
|
||||
// POD: Plain old data (that fits into a 64 bit register)
|
||||
|
||||
TScalarKind = (skInteger, skInt64, skUInt64, skSingle, skDouble, skTimestamp, skBoolean, skChar, skString, skBytes);
|
||||
|
||||
TScalarValue = record
|
||||
case TScalarKind of
|
||||
skInteger: (AsInteger: Integer);
|
||||
skInt64: (AsInt64: Int64);
|
||||
skUInt64: (AsUInt64: UInt64);
|
||||
skSingle: (AsSingle: Single);
|
||||
skDouble: (AsDouble: Double);
|
||||
skTimestamp: (AsTimeStamp: TDateTime);
|
||||
skBoolean: (AsBoolean: Boolean);
|
||||
skChar: (AsChar: Char);
|
||||
skString: (AsString: String[15]);
|
||||
skBytes: (AsBytes: array[0..15] of Byte);
|
||||
end;
|
||||
|
||||
TScalar = record
|
||||
Kind: TScalarKind;
|
||||
Value: TScalarValue;
|
||||
end;
|
||||
|
||||
// Basic data structures using the scalar type (these ar not POD of course)
|
||||
|
||||
TScalarArray = record
|
||||
Kind: TScalarKind;
|
||||
Items: TArray<TScalarValue>;
|
||||
end;
|
||||
|
||||
TScalarTuple = TArray<TScalar>;
|
||||
|
||||
TScalarRecordField = record
|
||||
Name: String;
|
||||
Kind: TScalarKind;
|
||||
end;
|
||||
|
||||
TScalarRecordDefinition = record
|
||||
Fields: TArray<TScalarRecordField>;
|
||||
end;
|
||||
|
||||
TScalarRecord = record
|
||||
Def: TScalarRecordDefinition;
|
||||
Fields: TArray<TScalarValue>;
|
||||
end;
|
||||
|
||||
TScalarSeries = record
|
||||
Kind: TScalarKind;
|
||||
Items: TSeries<TScalarValue>;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
initialization
|
||||
Assert(sizeof(TScalarValue) = 16);
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user