Opc.Ua.Server.StateMachine.ConstructMachine C# (CSharp) Method

ConstructMachine() protected method

Contructs the machine by reading the address space.
protected ConstructMachine ( object configuration ) : void
configuration object
return void
        protected void ConstructMachine(object configuration)
        {
            m_causes = new Dictionary<QualifiedName,MethodSource>();
            m_substateMachines = new List<StateMachine>();

            foreach (ILocalNode source in NodeManager.GetLocalNodes(this.NodeId, ReferenceTypeIds.HasComponent, false, true))
            {
                StateMachine substate = source as StateMachine;

                if (substate != null)
                {
                    // substate machines always report events to their parent.
                    substate.ReportEventsToParent = true;
                    m_substateMachines.Add(substate);
                    continue;
                }

                MethodSource cause = source as MethodSource;

                if (cause != null)
                {
                    m_causes.Add(cause.BrowseName, cause);
                    continue;
                }
            }

            ConstructMachineFromType(this.TypeDefinitionId);

            // get the parent state.
            ILocalNode parentState = NodeManager.GetTargetNode(this.NodeId, ReferenceTypes.HasSubStateMachine, false, true, null);

            if (parentState != null)
            {
                m_parentState = parentState.BrowseName;
            }

            GotoInitialState();
        }
        #endregion