public override void Execute()
            {
                if (!objectCreationGraphNode.propertyChanged)
                {
                    return;
                }
                objectCreationGraphNode.propertyChanged = false;
                UpdateNodeRef updateNode = objectCreationGraphNode.updateNodeRefList[0];

                GraphUpdateReadyEventArgs retArgs = null;

                lock (runner.operationsMutex)
                {
                    try
                    {
                        // @keyu: graph nodes may have been recreated caused of
                        // some update on the UI so that we have to find out
                        // new graph code that create this ffi object.
                        var graph      = runner.runnerCore.DSExecutable.instrStreamList[0].dependencyGraph;
                        var graphnodes = graph.GetGraphNodesAtScope(this.objectCreationGraphNode.classIndex, this.objectCreationGraphNode.procIndex);
                        foreach (var graphnode in graphnodes)
                        {
                            if ((graphnode == objectCreationGraphNode) ||
                                (graphnode.updateNodeRefList.Count == 1 &&
                                 updateNode.IsEqual(graphnode.updateNodeRefList[0])))
                            {
                                graphnode.propertyChanged = true;
                                break;
                            }
                        }

                        runner.ResetVMForExecution();
                        runner.Execute();

                        var modfiedGuidList = runner.GetModifiedGuidList();
                        runner.ResetModifiedSymbols();
                        var syncDataReturn = runner.CreateSynchronizeDataForGuidList(modfiedGuidList);
                        retArgs = new GraphUpdateReadyEventArgs(syncDataReturn);
                    }
                    catch (Exception e)
                    {
                        retArgs = new GraphUpdateReadyEventArgs(new SynchronizeData(),
                                                                EventStatus.Error,
                                                                e.Message);
                    }
                }

                if (runner.GraphUpdateReady != null)
                {
                    runner.GraphUpdateReady(this, retArgs);
                }
            }
Example #2
0
        public void PushSymbolReference(ProtoCore.DSASM.SymbolNode symbol)
        {
            Debug.Assert(null != symbol);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.symbol = symbol;
            updateNode.nodeType = UpdateNodeType.kSymbol;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.block = symbol.runtimeTableIndex;
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
Example #3
0
        public void PushSymbolReference(ProtoCore.DSASM.SymbolNode symbol, ProtoCore.AssociativeGraph.UpdateNodeType type = UpdateNodeType.kSymbol)
        {
            Debug.Assert(null != symbol);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.symbol = symbol;
            updateNode.nodeType = type;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
Example #4
0
        public void PushProcReference(ProtoCore.DSASM.ProcedureNode proc)
        {
            Debug.Assert(null != proc);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.procNode = proc;
            updateNode.nodeType = UpdateNodeType.kMethod;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
Example #5
0
 public bool IsUpdateableBy(UpdateNodeRef modifiedRef)
 {
     // Function to check if the current graphnode can be modified by the modified reference
     bool isUpdateable = false;
     if (modifiedRef.nodeList.Count < updateNodeRefList[0].nodeList.Count)
     {
         isUpdateable = true;
         for (int n = 0; n < modifiedRef.nodeList.Count; ++n)
         {
             ProtoCore.AssociativeGraph.UpdateNode updateNode = modifiedRef.nodeList[n];
             if (!updateNode.IsEqual(updateNodeRefList[0].nodeList[n]))
             {
                 isUpdateable = false;
                 break;
             }
         }
     }
     return isUpdateable;
 }
Example #6
0
 public void PushUpdateNodeRef(UpdateNodeRef nodeRef)
 {
     Validity.Assert(null != nodeList);
     foreach (UpdateNode node in nodeRef.nodeList)
     {
         nodeList.Add(node);
     }
 }
Example #7
0
        public bool IsEqual(UpdateNodeRef rhs)
        {
            if (nodeList.Count != rhs.nodeList.Count)
            {
                return false;
            }

            for (int n = 0; n < nodeList.Count; ++n)
            {
                if (nodeList[n].dimensionNodeList.Count != rhs.nodeList[n].dimensionNodeList.Count)
                {
                    return false;
                }
                else if (nodeList[n].dimensionNodeList.Count != 0)
                {
                    for (int m = 0; m < nodeList[n].dimensionNodeList.Count; m++)
                    {
                        if (nodeList[n].dimensionNodeList[m].symbol.name != rhs.nodeList[n].dimensionNodeList[m].symbol.name)
                        {
                            return false;
                        }
                    }
                }
                if (!nodeList[n].IsEqual(rhs.nodeList[n]))
                {
                    return false;
                }
            }
            return true;
        }
Example #8
0
 public UpdateNodeRef GetUntilFirstProc()
 {
     Validity.Assert(null != nodeList);
     UpdateNodeRef newRef = new UpdateNodeRef();
     foreach (UpdateNode node in nodeList)
     {
         if (node.nodeType != UpdateNodeType.kMethod)
         {
             newRef.nodeList.Add(node);
         }
     }
     return newRef;
 }
Example #9
0
 public UpdateNodeRef(UpdateNodeRef rhs)
 {
     nodeList = new List<UpdateNode>();
     if (null != rhs && null != rhs.nodeList)
     {
         foreach (UpdateNode node in rhs.nodeList)
         {
             PushUpdateNode(node);
         }
     }
 }