public ComposedScalar(QName name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter)
     : base(name, optional)
 {
     this.fields = fields;
     this.valueConverter = valueConverter;
     this.type = type;
 }
示例#2
0
 static OperatorCodec()
 {
     NONE_ALL          = new NoneOperatorCodec(Operator.NONE, FASTType.ALL_TYPES());
     CONSTANT_ALL      = new ConstantOperatorCodec(Operator.CONSTANT, FASTType.ALL_TYPES());
     DEFAULT_ALL       = new DefaultOperatorCodec(Operator.DEFAULT, FASTType.ALL_TYPES());
     INCREMENT_INTEGER = new IncrementIntegerOperatorCodec(Operator.INCREMENT, FASTType.INTEGER_TYPES);
     DELTA_INTEGER     = new DeltaIntegerOperatorCodec(Operator.DELTA, FASTType.INTEGER_TYPES);
     TAIL = new TailOperatorCodec(Operator.TAIL, new[] { FASTType.ASCII, FASTType.STRING, FASTType.UNICODE, FASTType.BYTE_VECTOR });
 }
        public override bool ShouldConvert(Field field)
        {
            if (!field.GetType().Equals(typeof(Scalar)))
            {
                return(false);
            }
            Type type = ((Scalar)field).Type;

            return(type.Equals(Type.BYTE_VECTOR) || type.Equals(Type.UNICODE));
        }
示例#4
0
文件: Scalar.cs 项目: radtek/Gradual
 public Scalar(QName name, FASTType type, OperatorCodec operatorCodec, ScalarValue defaultValue, bool optional) : base(name, optional)
 {
     InitBlock();
     operator_Renamed   = operatorCodec.Operator;
     this.operatorCodec = operatorCodec;
     dictionary         = "global";
     this.defaultValue  = defaultValue ?? ScalarValue.UNDEFINED;
     this.type          = type;
     typeCodec          = type.GetCodec(operator_Renamed, optional);
     initialValue       = ((defaultValue == null) || defaultValue.Undefined)?this.type.DefaultValue:defaultValue;
     operator_Renamed.Validate(this);
 }
示例#5
0
        public static OperatorCodec GetCodec(Operator operator_Renamed, FASTType type)
        {
            var key = new Key(operator_Renamed, type);

            if (!OPERATOR_MAP.ContainsKey(key))
            {
                Global.HandleError(Error.FastConstants.S2_OPERATOR_TYPE_INCOMP, "The operator \"" + operator_Renamed + "\" is not compatible with type \"" + type + "\"");
                throw new ArgumentException();
            }

            return(OPERATOR_MAP[key]);
        }
示例#6
0
 public Scalar(QName name, FASTType type, OperatorCodec operatorCodec, ScalarValue defaultValue, bool optional)
     : base(name, optional)
 {
     InitBlock();
     operator_Renamed = operatorCodec.Operator;
     this.operatorCodec = operatorCodec;
     dictionary = "global";
     this.defaultValue = defaultValue ?? ScalarValue.UNDEFINED;
     this.type = type;
     typeCodec = type.GetCodec(operator_Renamed, optional);
     initialValue = ((defaultValue == null) || defaultValue.Undefined)?this.type.DefaultValue:defaultValue;
     operator_Renamed.Validate(this);
 }
        protected internal OperatorCodec(Operator operator_Renamed, FASTType[] types)
        {
            this.operator_Renamed = operator_Renamed;
            for (int i = 0; i < types.Length; i++)
            {
                var key = new Key(operator_Renamed, types[i]);

                if (!OPERATOR_MAP.ContainsKey(key))
                {
                    OPERATOR_MAP[key] = this;
                }
            }
        }
示例#8
0
        public override Field Parse(System.Xml.XmlElement fieldNode, bool optional, ParsingContext context)
        {
            Operator.Operator operator_Renamed = Operator.Operator.NONE;
            string            defaultValue     = null;
            string            key = null;
            string            ns  = "";

            System.Xml.XmlElement operatorElement = GetOperatorElement(fieldNode);
            if (operatorElement != null)
            {
                if (operatorElement.HasAttribute("value"))
                {
                    defaultValue = operatorElement.GetAttribute("value");
                }
                operator_Renamed = Operator.Operator.GetOperator(operatorElement.Name);
                if (operatorElement.HasAttribute("key"))
                {
                    key = operatorElement.GetAttribute("key");
                }
                if (operatorElement.HasAttribute("ns"))
                {
                    ns = operatorElement.GetAttribute("ns");
                }
                if (operatorElement.HasAttribute("dictionary"))
                {
                    context.Dictionary = operatorElement.GetAttribute("dictionary");
                }
            }
            FASTType type   = GetType(fieldNode, context);
            var      scalar = new Scalar(GetName(fieldNode, context), type, operator_Renamed, type.GetValue(defaultValue), optional);

            if (fieldNode.HasAttribute("id"))
            {
                scalar.Id = fieldNode.GetAttribute("id");
            }
            if (key != null)
            {
                scalar.Key = new QName(key, ns);
            }
            scalar.Dictionary = context.Dictionary;
            ParseExternalAttributes(fieldNode, scalar);
            return(scalar);
        }
 internal DeltaIntegerOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
示例#10
0
文件: Scalar.cs 项目: radtek/Gradual
 public Scalar(string name, FASTType type, Operator.Operator operator_Renamed, ScalarValue defaultValue, bool optional)
     : this(new QName(name), type, operator_Renamed, defaultValue, optional)
 {
 }
示例#11
0
文件: Scalar.cs 项目: radtek/Gradual
 private static void  ValidateDecodedValueIsCorrectForType(ScalarValue value_Renamed, FASTType type)
 {
     if (value_Renamed == null)
     {
         return;
     }
     type.ValidateValue(value_Renamed);
 }
 protected internal OptionallyPresentOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
示例#13
0
 public Scalar(string name, FASTType type, Operator.Operator operator_Renamed, ScalarValue defaultValue, bool optional)
     : this(new QName(name), type, operator_Renamed, defaultValue, optional)
 {
 }
示例#14
0
 private static void ValidateDecodedValueIsCorrectForType(ScalarValue value_Renamed, FASTType type)
 {
     if (value_Renamed == null)
         return ;
     type.ValidateValue(value_Renamed);
 }
示例#15
0
 public ComposedScalar(string name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter) : this(new QName(name), type, fields, optional, valueConverter)
 {
 }
示例#16
0
 public virtual OperatorCodec GetCodec(FASTType type)
 {
     return OperatorCodec.GetCodec(this, type);
 }
 protected internal AlwaysPresentOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
 public ComposedScalar(string name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter)
     : this(new QName(name), type, fields, optional, valueConverter)
 {
 }
示例#19
0
 public override OperatorCodec GetCodec(FASTType type)
 {
     return(OperatorCodec.COPY_ALL);
 }
示例#20
0
 public virtual OperatorCodec GetCodec(FASTType type)
 {
     return(OperatorCodec.GetCodec(this, type));
 }
示例#21
0
 internal CopyOperatorCodec() : base(Operator.COPY, FASTType.ALL_TYPES())
 {
 }
        public static OperatorCodec GetCodec(Operator operator_Renamed, FASTType type)
        {
            var key = new Key(operator_Renamed, type);

            if (!OPERATOR_MAP.ContainsKey(key))
            {
                Global.HandleError(Error.FastConstants.S2_OPERATOR_TYPE_INCOMP, "The operator \"" + operator_Renamed + "\" is not compatible with type \"" + type + "\"");
                throw new ArgumentException();
            }

            return OPERATOR_MAP[key];
        }
 internal DefaultOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
 internal IncrementIntegerOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
示例#25
0
 public ComposedScalar(QName name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter) : base(name, optional)
 {
     this.fields         = fields;
     this.valueConverter = valueConverter;
     this.type           = type;
 }
 internal ConstantOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }
示例#27
0
 private static void ValidateDictionaryTypeAgainstFieldType(ScalarValue previousValue, FASTType type)
 {
     if (previousValue == null || previousValue.Undefined)
         return ;
     if (!type.IsValueOf(previousValue))
     {
         Global.HandleError(Error.FastConstants.D4_INVALID_TYPE, "The value \"" + previousValue + "\" is not valid for the type " + type);
     }
 }
示例#28
0
文件: Scalar.cs 项目: radtek/Gradual
 private static void  ValidateDictionaryTypeAgainstFieldType(ScalarValue previousValue, FASTType type)
 {
     if (previousValue == null || previousValue.Undefined)
     {
         return;
     }
     if (!type.IsValueOf(previousValue))
     {
         Global.HandleError(Error.FastConstants.D4_INVALID_TYPE, "The value \"" + previousValue + "\" is not valid for the type " + type);
     }
 }
示例#29
0
 public override OperatorCodec GetCodec(FASTType type)
 {
     return OperatorCodec.COPY_ALL;
 }
 internal NoneOperatorCodec(Operator operator_Renamed, FASTType[] types)
     : base(operator_Renamed, types)
 {
 }