示例#1
0
        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);
        }
示例#2
0
 /// <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);
示例#3
0
 public SequenceComputationProcedureMethodCall(SequenceVariable targetVar, ProcedureInvocationParameterBindings paramBindings)
     : base(SequenceComputationType.ProcedureMethodCall, paramBindings)
 {
     TargetVar = targetVar;
 }
示例#4
0
 /// <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);
示例#5
0
 public SequenceComputationProcedureCall(SequenceComputationType seqCompType, ProcedureInvocationParameterBindings paramBindings)
     : base(seqCompType)
 {
     ParamBindings = paramBindings;
 }
示例#6
0
 public SequenceComputationProcedureMethodCall(SequenceExpression targetExpr, ProcedureInvocationParameterBindings paramBindings)
     : base(SequenceComputationType.ProcedureMethodCall, paramBindings)
 {
     TargetExpr = targetExpr;
 }
示例#7
0
 public SequenceComputationProcedureCall(ProcedureInvocationParameterBindings paramBindings)
     : base(SequenceComputationType.ProcedureCall)
 {
     ParamBindings = paramBindings;
 }
示例#8
0
 public override bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings)
 {
     return proceduresToIsExternal[paramBindings.PackagePrefixedName];
 }
示例#9
0
 public override bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings)
 {
     return paramBindings.ProcedureDef.IsExternal;
 }
示例#10
0
 public abstract bool IsProcedureCallExternal(ProcedureInvocationParameterBindings paramBindings);
示例#11
0
        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);
            }
        }