Esempio n. 1
0
        /// <summary>
        /// Validates the PFC in this instance, and sets (MUST SET) the m_pfcIsValid to true or false.
        /// </summary>
        private void Validate()
        {
            try
            {
                m_activePath = new Queue <QueueData>();

                foreach (IPfcNode node in m_pfc.Nodes)
                {
                    NodeValidationData.Attach(node);
                }
                foreach (IPfcLinkElement link in m_pfc.Links)
                {
                    LinkValidationData.Attach(link);
                }
                BuildDependencies();
                Propagate();
                Check();

                DateTime finish = DateTime.Now;
                foreach (IPfcNode node in m_pfc.Nodes)
                {
                    NodeValidationData.Detach(node);
                }
                foreach (IPfcLinkElement link in m_pfc.Links)
                {
                    LinkValidationData.Detach(link);
                }
            }
            catch (Exception e)
            {
                m_errorList.Add(new PfcValidationError("Exception while validating.", e.Message, null));
                m_pfcIsValid = false;
            }
        }
Esempio n. 2
0
        private void BuildDependencies(IPfcNode node, Stack <IPfcLinkElement> stack)
        {
            foreach (IPfcLinkElement outbound in node.Successors)
            {
                if (!stack.Contains(outbound))
                {
                    LinkValidationData lvd = GetValidationData(outbound);
                    if (lvd.NodesBelow == null)
                    {
                        stack.Push(outbound);
                        BuildDependencies(outbound.Successor, stack);
                        stack.Pop();

                        lvd.NodesBelow = new bool[m_maxGraphOrdinal + 1];
                        lvd.NodesBelow[outbound.Successor.GraphOrdinal] = true;
                        foreach (IPfcLinkElement succOutboundLink in outbound.Successor.Successors)
                        {
                            LinkValidationData lvSuccLink = GetValidationData(succOutboundLink);
                            if (lvSuccLink.NodesBelow != null)
                            {
                                for (int i = 0; i < m_maxGraphOrdinal + 1; i++)
                                {
                                    lvd.NodesBelow[i] |= lvSuccLink.NodesBelow[i];
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
            public static void Detach(IPfcLinkElement link)
            {
                LinkValidationData vd = link.UserData as LinkValidationData;

                if (vd != null)
                {
                    link.UserData = vd.m_userData;
                }
            }