public override object GetUntypedValue(PackedTuple tuple, ref PackedFieldDescriptor descriptor, out TupleFieldState fieldState)
        {
            var state = tuple.GetFieldState(ref descriptor);

            fieldState = state;
            return(state == TupleFieldState.Available ? tuple.Objects[descriptor.ObjectIndex] : null);
        }
        public override bool ValueEquals(PackedTuple left, ref PackedFieldDescriptor leftDescriptor,
                                         PackedTuple right, ref PackedFieldDescriptor rightDescriptor)
        {
            var leftValue  = left.Objects[leftDescriptor.ObjectIndex];
            var rightValue = right.Objects[rightDescriptor.ObjectIndex];

            return(leftValue.Equals(rightValue));
        }
Example #3
0
        private PackedTuple(PackedTuple origin)
        {
            PackedDescriptor = origin.PackedDescriptor;

            Values  = (long[])origin.Values.Clone();
            Objects = PackedDescriptor.ObjectsLength > 0
        ? (object[])origin.Objects.Clone()
        : EmptyObjectArray;
        }
 public override void SetUntypedValue(PackedTuple tuple, ref PackedFieldDescriptor descriptor, object value)
 {
     tuple.Objects[descriptor.ObjectIndex] = value;
     if (value != null)
     {
         tuple.SetFieldState(ref descriptor, TupleFieldState.Available);
     }
     else
     {
         tuple.SetFieldState(ref descriptor, TupleFieldState.Available | TupleFieldState.Null);
     }
 }
        public void SetValue <T>(PackedTuple tuple, ref PackedFieldDescriptor descriptor, bool isNullable, T value)
        {
            var setter = (isNullable ? NullableSetter : Setter) as SetValueDelegate <T>;

            if (setter != null)
            {
                setter.Invoke(tuple, ref descriptor, value);
            }
            else
            {
                SetUntypedValue(tuple, ref descriptor, value);
            }
        }
        public T GetValue <T>(PackedTuple tuple, ref PackedFieldDescriptor descriptor, bool isNullable, out TupleFieldState fieldState)
        {
            var getter = (isNullable ? NullableGetter : Getter) as GetValueDelegate <T>;

            if (getter != null)
            {
                return(getter.Invoke(tuple, ref descriptor, out fieldState));
            }
            var targetType = typeof(T);

            //Dirty hack of nullable enum reading
            if (isNullable)
            {
                targetType = Nullable.GetUnderlyingType(targetType) ?? targetType;
            }
            if (targetType.IsEnum)
            {
                return((T)Enum.ToObject(targetType, GetUntypedValue(tuple, ref descriptor, out fieldState)));
            }
            return((T)GetUntypedValue(tuple, ref descriptor, out fieldState));
        }
 public abstract int GetValueHashCode(PackedTuple tuple, ref PackedFieldDescriptor descriptor);
 public abstract bool ValueEquals(PackedTuple left, ref PackedFieldDescriptor leftDescriptor,
                                  PackedTuple right, ref PackedFieldDescriptor rightDescriptor);
 public abstract void CopyValue(PackedTuple source, ref PackedFieldDescriptor sourceDescriptor,
                                PackedTuple target, ref PackedFieldDescriptor targetDescriptor);
 public abstract void SetUntypedValue(PackedTuple tuple, ref PackedFieldDescriptor descriptor, object value);
 public abstract object GetUntypedValue(PackedTuple tuple, ref PackedFieldDescriptor descriptor, out TupleFieldState fieldState);
 public override int GetValueHashCode(PackedTuple tuple, ref PackedFieldDescriptor descriptor)
 {
     return(tuple.Objects[descriptor.ObjectIndex].GetHashCode());
 }
 public override void CopyValue(PackedTuple source, ref PackedFieldDescriptor sourceDescriptor,
                                PackedTuple target, ref PackedFieldDescriptor targetDescriptor)
 {
     target.Objects[targetDescriptor.ObjectIndex] = source.Objects[sourceDescriptor.ObjectIndex];
 }