Assembly: DiscreteLogics.TeaFiles (in DiscreteLogics.TeaFiles.dll) Version: 1.0.0.16 (1.0.0.16)
Syntax
[FlagsAttribute] public enum ItemDescriptionElements
Members
Member name | Value | Description | |
---|---|---|---|
None | 0 | no item description part. | |
ItemName | 1 | the item . | |
ItemSize | 2 | the item size. | |
FieldOffsets | 4 | field offsets. | |
FieldNames | 12 | field names. | |
FieldTypes | 20 | field types. | |
All | 255 | all item description parts. |
Remarks
A TeaFile holds a description of the item type it stores. This item description has several elements:
- the name of the item type (e.g. "Tick", "OHLCV")
- the size of the item
- the number of fields and their
- name,
- offset and
- type.
When a typed TeaFile<(Of <(<'T>)>)> is opened, the ItemDescription of {T} is compared against those in the file. If it does not match those
stored in the file, an exception is thrown. This ensures that a TeaFile is read with the correct type. For instance,
a file that was written using the item type
struct Tick
{
public Time Time;
public double Price;
}
struct A
{
public Time Time;
public short Value1;
public float Value2;
public double Value3;
}
TeaFile<A>.OpenRead("lab.tea");
Examples
struct Tick { public Time Time; public double Price; } TeaFile<Tick>.Create("lab.tea"); // now we read this file using another type. struct NewTick { public Time NewTime; public double NewPrice; } TeaFile<NewTick>.OpenRead("lab.tea", ItemDescriptionElements.FieldTypes);