private void OnTypeGenerated(IDataType type) { if (this.TypesGenerated != null) { DataTypeCollection types = new DataTypeCollection(); types.Add(type); this.TypesGenerated(this, new DataTypeEventArgs(types)); } }
public static DataTypeCollection <IDataType> CreateBuildInTypes() { DataTypeCollection <IDataType> types = new DataTypeCollection <IDataType>(); DataType item = new PrimitiveType("TOD", AdsDatatypeId.ADST_BIGTYPE, 4, PrimitiveTypeFlags.Time, typeof(TOD)); DataType type2 = new PrimitiveType("DT", AdsDatatypeId.ADST_BIGTYPE, 4, PrimitiveTypeFlags.MaskDateTime, typeof(DT)); DataType type3 = new PrimitiveType("UDINT", AdsDatatypeId.ADST_UINT32, 4, PrimitiveTypeFlags.Unsigned, typeof(uint)); types.Add(new BitMappingType("BIT", 1, typeof(bool))); types.Add(new BitMappingType("BIT2", 2, typeof(byte))); types.Add(new BitMappingType("BIT3", 3, typeof(byte))); types.Add(new BitMappingType("BIT4", 4, typeof(byte))); types.Add(new BitMappingType("BIT5", 5, typeof(byte))); types.Add(new BitMappingType("BIT6", 6, typeof(byte))); types.Add(new BitMappingType("BIT7", 7, typeof(byte))); types.Add(new BitMappingType("BIT8", 8, typeof(byte))); types.Add(new PrimitiveType("VOID", AdsDatatypeId.ADST_VOID, 0, PrimitiveTypeFlags.None, typeof(void))); PointerType type4 = new PointerType("POINTER TO VOID", "VOID"); types.Add(type4); AliasType type5 = new AliasType("PVOID", type4); types.Add(type5); types.Add(new PrimitiveType("SINT", AdsDatatypeId.ADST_INT8, 1, PrimitiveTypeFlags.Numeric, typeof(sbyte))); types.Add(new PrimitiveType("USINT", AdsDatatypeId.ADST_UINT8, 1, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(byte))); types.Add(new PrimitiveType("BYTE", AdsDatatypeId.ADST_UINT8, 1, PrimitiveTypeFlags.Unsigned | PrimitiveTypeFlags.System, typeof(byte))); types.Add(new PrimitiveType("UINT8", AdsDatatypeId.ADST_UINT8, 1, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(byte))); types.Add(new PrimitiveType("INT", AdsDatatypeId.ADST_INT16, 2, PrimitiveTypeFlags.Numeric, typeof(short))); types.Add(new PrimitiveType("INT16", AdsDatatypeId.ADST_INT16, 2, PrimitiveTypeFlags.Numeric, typeof(short))); types.Add(new PrimitiveType("UINT", AdsDatatypeId.ADST_UINT16, 2, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(ushort))); types.Add(new PrimitiveType("WORD", AdsDatatypeId.ADST_UINT16, 2, PrimitiveTypeFlags.Unsigned | PrimitiveTypeFlags.System, typeof(ushort))); types.Add(new PrimitiveType("UINT16", AdsDatatypeId.ADST_UINT16, 2, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(ushort))); types.Add(new PrimitiveType("DINT", AdsDatatypeId.ADST_INT32, 4, PrimitiveTypeFlags.Numeric, typeof(int))); types.Add(new PrimitiveType("INT32", AdsDatatypeId.ADST_INT32, 4, PrimitiveTypeFlags.Numeric, typeof(int))); types.Add(type3); types.Add(new PrimitiveType("UINT32", AdsDatatypeId.ADST_UINT32, 4, PrimitiveTypeFlags.Numeric, typeof(uint))); types.Add(new PrimitiveType("DWORD", AdsDatatypeId.ADST_UINT32, 4, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(uint))); types.Add(new PrimitiveType("REAL", AdsDatatypeId.ADST_REAL32, 4, PrimitiveTypeFlags.Numeric | PrimitiveTypeFlags.Float, typeof(float))); types.Add(new PrimitiveType("FLOAT", AdsDatatypeId.ADST_REAL32, 4, PrimitiveTypeFlags.Numeric | PrimitiveTypeFlags.Float, typeof(float))); types.Add(new PrimitiveType("LREAL", AdsDatatypeId.ADST_REAL64, 8, PrimitiveTypeFlags.Numeric | PrimitiveTypeFlags.Float, typeof(double))); types.Add(new PrimitiveType("DOUBLE", AdsDatatypeId.ADST_REAL64, 8, PrimitiveTypeFlags.Numeric | PrimitiveTypeFlags.Float, typeof(double))); types.Add(new PrimitiveType("BOOL", AdsDatatypeId.ADST_BIT, 1, PrimitiveTypeFlags.System, typeof(bool))); types.Add(new PrimitiveType("TIME", AdsDatatypeId.ADST_BIGTYPE, 4, PrimitiveTypeFlags.Time, typeof(TIME))); types.Add(item); types.Add(new PrimitiveType("DATE", AdsDatatypeId.ADST_BIGTYPE, 4, PrimitiveTypeFlags.Date, typeof(DATE))); types.Add(type2); types.Add(new PrimitiveType("LTIME", AdsDatatypeId.ADST_BIGTYPE, 8, PrimitiveTypeFlags.System, typeof(LTIME))); types.Add(new AliasType("DATE_AND_TIME", type2)); types.Add(new AliasType("TIME_OF_DAY", item)); types.Add(new PrimitiveType("LINT", AdsDatatypeId.ADST_INT64, 8, PrimitiveTypeFlags.Numeric, typeof(long))); types.Add(new PrimitiveType("ULINT", AdsDatatypeId.ADST_UINT64, 8, PrimitiveTypeFlags.MaskNumericUnsigned, typeof(ulong))); types.Add(new PrimitiveType("LWORD", AdsDatatypeId.ADST_UINT64, 8, PrimitiveTypeFlags.Numeric, typeof(ulong))); types.Add(new AliasType("OTCID", type3)); types.Add(new AliasType("UXINT", type5)); return(types); }
public override DataTypeCollection GetDataTypesInfo() { var commonFeatures = DataTypeFeatures.Clustering | DataTypeFeatures.Grouping | DataTypeFeatures.Indexing | DataTypeFeatures.KeyConstraint | DataTypeFeatures.Nullable | DataTypeFeatures.Ordering | DataTypeFeatures.Multiple | DataTypeFeatures.Default; var dtc = new DataTypeCollection(); dtc.Boolean = DataTypeInfo.Range(SqlType.Boolean, commonFeatures, ValueRange.Bool, "boolean", "bool"); dtc.Int16 = DataTypeInfo.Range(SqlType.Int16, commonFeatures, ValueRange.Int16, "smallint", "int2"); dtc.Int32 = DataTypeInfo.Range(SqlType.Int32, commonFeatures, ValueRange.Int32, "integer", "int4"); dtc.Int64 = DataTypeInfo.Range(SqlType.Int64, commonFeatures, ValueRange.Int64, "bigint", "int8"); dtc.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, commonFeatures, ValueRange.Decimal, 49, "numeric", "decimal"); dtc.Float = DataTypeInfo.Range(SqlType.Float, commonFeatures, ValueRange.Float, "real", "float4"); dtc.Double = DataTypeInfo.Range(SqlType.Double, commonFeatures, ValueRange.Double, "double precision", "float8"); dtc.DateTime = DataTypeInfo.Range(SqlType.DateTime, commonFeatures, ValueRange.DateTime, "timestamp"); dtc.Interval = DataTypeInfo.Range(SqlType.Interval, commonFeatures, ValueRange.TimeSpan, "interval"); dtc.Char = DataTypeInfo.Stream(SqlType.Char, commonFeatures, MaxCharLength, "character", "char", "bpchar"); dtc.VarChar = DataTypeInfo.Stream(SqlType.VarChar, commonFeatures, MaxCharLength, "character varying", "varchar"); dtc.VarCharMax = DataTypeInfo.Regular(SqlType.VarCharMax, commonFeatures, "text"); dtc.VarBinaryMax = DataTypeInfo.Stream(SqlType.VarBinaryMax, commonFeatures, MaxTextLength, "bytea"); dtc.DateTimeOffset = DataTypeInfo.Range(SqlType.DateTimeOffset, commonFeatures, new ValueRange <DateTimeOffset>(new DateTimeOffset(1, 1, 1, 0, 0, 0, 0, new TimeSpan(0)), new DateTimeOffset(9999, 12, 31, 0, 0, 0, 0, new TimeSpan(0))), "timestamptz"); var geo = DataTypeFeatures.Default | DataTypeFeatures.Nullable | DataTypeFeatures.Multiple | DataTypeFeatures.Spatial; dtc.Add(CustomSqlType.Point, DataTypeInfo.Regular(CustomSqlType.Point, geo, "point")); dtc.Add(CustomSqlType.LSeg, DataTypeInfo.Regular(CustomSqlType.LSeg, geo, "lseg")); dtc.Add(CustomSqlType.Box, DataTypeInfo.Regular(CustomSqlType.Box, geo, "box")); dtc.Add(CustomSqlType.Path, DataTypeInfo.Regular(CustomSqlType.Path, geo, "path")); dtc.Add(CustomSqlType.Polygon, DataTypeInfo.Regular(CustomSqlType.Polygon, geo, "polygon")); dtc.Add(CustomSqlType.Circle, DataTypeInfo.Regular(CustomSqlType.Circle, geo, "circle")); return(dtc); }