public static ISerializableEvaluation unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException { int op = buffer.getByte(); ICPPEvaluation arg = (ICPPEvaluation) buffer.unmarshalEvaluation(); IBinding binding = buffer.unmarshalBinding(); return new EvalUnary(op, arg, binding); }
@Override public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { buffer.putByte(ITypeMarshalBuffer.EVAL_UNARY); buffer.putByte((byte) fOperator); buffer.marshalEvaluation(fArgument, includeValue); buffer.marshalBinding(fAddressOfQualifiedNameBinding); }
@Override public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { buffer.putShort(ITypeMarshalBuffer.EXEC_SWITCH); buffer.marshalEvaluation(controllerExprEval, includeValue); buffer.marshalExecution(controllerDeclExec, includeValue); buffer.putInt(bodyStmtExecutions.length); for (ICPPExecution execution : bodyStmtExecutions) { buffer.marshalExecution(execution, includeValue); } }
public static ISerializableExecution unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { ICPPEvaluation controllerExprEval = (ICPPEvaluation) buffer.unmarshalEvaluation(); ExecSimpleDeclaration controllerDeclExec = (ExecSimpleDeclaration) buffer.unmarshalExecution(); int len = buffer.getInt(); ICPPExecution[] bodyStmtExecutions = new ICPPExecution[len]; for (int i = 0; i < bodyStmtExecutions.length; i++) { bodyStmtExecutions[i] = (ICPPExecution) buffer.unmarshalExecution(); } return new ExecSwitch(controllerExprEval, controllerDeclExec, bodyStmtExecutions); }
public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { final boolean qualified = (firstBytes & FLAG_QUALIFIED) != 0; final boolean addressOf = (firstBytes & FLAG_ADDRESS_OF) != 0; if ((firstBytes & FLAG_HAS_FUNCTION_SET) != 0) { int bindingCount = buffer.getInt(); ICPPFunction[] bindings = new ICPPFunction[bindingCount]; for (int i = 0; i < bindings.length; i++) { bindings[i] = (ICPPFunction) buffer.unmarshalBinding(); } ICPPTemplateArgument[] args = null; if ((firstBytes & FLAG_HAS_TEMPLATE_ARGS) != 0) { int len = buffer.getInt(); args = new ICPPTemplateArgument[len]; for (int i = 0; i < args.length; i++) { args[i] = buffer.unmarshalTemplateArgument(); } } IType impliedObjectType = buffer.unmarshalType(); IBinding templateDefinition = buffer.unmarshalBinding(); return new EvalFunctionSet( new CPPFunctionSet(bindings, args, null), qualified, addressOf, impliedObjectType, templateDefinition); } else { char[] name = buffer.getCharArray(); IBinding templateDefinition = buffer.unmarshalBinding(); return new EvalFunctionSet(name, qualified, addressOf, templateDefinition); } }
@Override public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { short firstBytes = ITypeMarshalBuffer.EVAL_FUNCTION_SET; if (fQualified) firstBytes |= FLAG_QUALIFIED; if (fAddressOf) firstBytes |= FLAG_ADDRESS_OF; if (fFunctionSet != null) { firstBytes |= FLAG_HAS_FUNCTION_SET; final ICPPFunction[] bindings = fFunctionSet.getBindings(); final ICPPTemplateArgument[] args = fFunctionSet.getTemplateArguments(); if (args != null) firstBytes |= FLAG_HAS_TEMPLATE_ARGS; buffer.putShort(firstBytes); buffer.putInt(bindings.length); for (ICPPFunction binding : bindings) { buffer.marshalBinding(binding); } if (args != null) { buffer.putInt(args.length); for (ICPPTemplateArgument arg : args) { buffer.marshalTemplateArgument(arg); } } buffer.marshalType(fImpliedObjectType); } else { buffer.putShort(firstBytes); buffer.putCharArray(fName); } marshalTemplateDefinition(buffer); }
public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { final boolean readValue = (firstBytes & ITypeMarshalBuffer.FLAG1) != 0; IValue value; ValueCategory cat; switch (firstBytes & (ITypeMarshalBuffer.FLAG2 | ITypeMarshalBuffer.FLAG3)) { case ITypeMarshalBuffer.FLAG2: cat = PRVALUE; break; case ITypeMarshalBuffer.FLAG3: cat = LVALUE; break; default: cat = XVALUE; break; } IType type = buffer.unmarshalType(); value = readValue ? buffer.unmarshalValue() : Value.UNKNOWN; return new EvalFixed(type, cat, value); }
@Override public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { includeValue = includeValue && fValue != Value.UNKNOWN; short firstBytes = ITypeMarshalBuffer.EVAL_FIXED; if (includeValue) firstBytes |= ITypeMarshalBuffer.FLAG1; switch (fValueCategory) { case PRVALUE: firstBytes |= ITypeMarshalBuffer.FLAG2; break; case LVALUE: firstBytes |= ITypeMarshalBuffer.FLAG3; break; default: break; } buffer.putShort(firstBytes); buffer.marshalType(fType); if (includeValue) { buffer.marshalValue(fValue); } }
public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException { IType nested = buffer.unmarshalType(); if (nested == null) return new ProblemBinding(null, IProblemBinding.SEMANTIC_INVALID_TYPE); return new CPPParameterPackType(nested); }
@Override public void marshal(ITypeMarshalBuffer buffer) throws CoreException { int firstByte = ITypeMarshalBuffer.PACK_EXPANSION_TYPE; buffer.putByte((byte) firstByte); buffer.marshalType(getType()); }