public ProcedureInvocationParameterBindings Copy(Dictionary <SequenceVariable, SequenceVariable> originalToCopy, IGraphProcessingEnvironment procEnv) { ProcedureInvocationParameterBindings copy = (ProcedureInvocationParameterBindings)MemberwiseClone(); copy.ArgumentExpressions = new SequenceExpression[ArgumentExpressions.Length]; for (int i = 0; i < ArgumentExpressions.Length; ++i) { copy.ArgumentExpressions[i] = ArgumentExpressions[i].CopyExpression(originalToCopy, procEnv); } copy.ReturnVars = new SequenceVariable[ReturnVars.Length]; for (int i = 0; i < ReturnVars.Length; ++i) { copy.ReturnVars[i] = ReturnVars[i].Copy(originalToCopy, procEnv); } copy.Arguments = new object[Arguments.Length]; for (int i = 0; i < Arguments.Length; ++i) { copy.Arguments[i] = Arguments[i]; } return(copy); }
/// <summary> /// Applies this procedure with the given action environment on the given graph. /// Takes the parameters from paramBindings as inputs. /// Returns an array of output values. /// Attention: at the next call of Apply, the array returned from previous call is overwritten with the new return values. /// </summary> public abstract object[] Apply(IActionExecutionEnvironment actionEnv, IGraph graph, ProcedureInvocationParameterBindings paramBindings);
public SequenceComputationProcedureMethodCall(SequenceVariable targetVar, ProcedureInvocationParameterBindings paramBindings) : base(SequenceComputationType.ProcedureMethodCall, paramBindings) { TargetVar = targetVar; }
/// <summary> /// Applies this procedure with the given action environment on the given graph. /// Takes the parameters from paramBindings as inputs. /// Returns an array of output values. /// Attention: at the next call of Apply, the array returned from previous call is overwritten with the new return values. /// </summary> public abstract object[] Apply(IActionExecutionEnvironment actionEnv, IGraph graph, ProcedureInvocationParameterBindings paramBindings);
public SequenceComputationProcedureCall(SequenceComputationType seqCompType, ProcedureInvocationParameterBindings paramBindings) : base(seqCompType) { ParamBindings = paramBindings; }
public SequenceComputationProcedureMethodCall(SequenceExpression targetExpr, ProcedureInvocationParameterBindings paramBindings) : base(SequenceComputationType.ProcedureMethodCall, paramBindings) { TargetExpr = targetExpr; }
public SequenceComputationProcedureCall(ProcedureInvocationParameterBindings paramBindings) : base(SequenceComputationType.ProcedureCall) { ParamBindings = paramBindings; }
public override bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings) { return proceduresToIsExternal[paramBindings.PackagePrefixedName]; }
public override bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings) { return paramBindings.ProcedureDef.IsExternal; }
public abstract bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings);
private void BuildReturnParameters(ProcedureInvocationParameterBindings paramBindings, GrGenType ownerType, out String returnParameterDeclarations, out String returnArguments, out String returnAssignments) { // can't use the normal xgrs variables for return value receiving as the type of an out-parameter must be invariant // this is bullshit, as it is perfectly safe to assign a subtype to a variable of a supertype // so we create temporary variables of exact type, which are used to receive the return values, // and finally we assign these temporary variables to the real xgrs variables returnParameterDeclarations = ""; returnArguments = ""; returnAssignments = ""; for(int i = 0; i < ownerType.GetProcedureMethod(paramBindings.Name).Outputs.Length; i++) { String varName; if(paramBindings.ReturnVars.Length != 0) varName = tmpVarCtr.ToString() + paramBindings.ReturnVars[i].PureName; else varName = tmpVarCtr.ToString(); ++tmpVarCtr; String typeName = TypesHelper.DotNetTypeToXgrsType(ownerType.GetProcedureMethod(paramBindings.Name).Outputs[i]); returnParameterDeclarations += TypesHelper.XgrsTypeToCSharpType(typeName, model) + " tmpvar_" + varName + "; "; returnArguments += ", out tmpvar_" + varName; if(paramBindings.ReturnVars.Length != 0) returnAssignments += SetVar(paramBindings.ReturnVars[i], "tmpvar_" + varName); } }