protected override void EncodeTyped(ref byte *data, ConstantExpression expression) { var type = expression.Type; var valueCodec = CodecContainer.GetAbstractManualCodecFor(type); typeCodec.Encode(ref data, type); valueCodec.Encode(ref data, expression.Value); }
protected override ConstantExpression DecodeTyped(ExpressionType expressionType, ref byte *data, ref int remainingBytes, bool doNotCheckBounds) { var type = typeCodec.Decode(ref data, ref remainingBytes, doNotCheckBounds); var valueCodec = CodecContainer.GetAbstractManualCodecFor(type); var value = valueCodec.Decode(ref data, ref remainingBytes, doNotCheckBounds); return(Expression.Constant(value, type)); }
protected override int CalculateSizeTyped(ConstantExpression expression) { var type = expression.Type; var valueCodec = CodecContainer.GetAbstractManualCodecFor(type); int result = 0; result += typeCodec.CalculateSize(type); result += valueCodec.CalculateSize(expression.Value); return(result); }