Beispiel #1
0
 /// <summary>
 /// Creates a new instance of the node.
 /// </summary>
 public static MethodSource Construct(
     IServerInternal server, 
     NodeSource      parent, 
     NodeId          referenceTypeId,
     NodeId          nodeId,
     QualifiedName   browseName,
     uint            numericId)
 {
     MethodSource instance = new MethodSource(server, parent);
     instance.Initialize(referenceTypeId, nodeId, browseName, numericId, null);
     return instance;
 }
Beispiel #2
0
        /// <summary>
        /// Called to process a transition that was found in the machine.
        /// </summary>
        protected virtual void AddTransition(ILocalNode source)
        {
            Transition transition = new Transition(source);

            // save the transition.
            m_transitions.Add(transition);

            // add the from state.
            ILocalNode fromState = NodeManager.GetTargetNode(source.NodeId, ReferenceTypes.FromState, false, true, null);

            if (fromState != null)
            {
                transition.FromState = m_states[fromState.BrowseName];
            }

            // add the to state.
            ILocalNode toState = NodeManager.GetTargetNode(source.NodeId, ReferenceTypes.ToState, false, true, null);

            if (fromState != null)
            {
                transition.ToState = m_states[toState.BrowseName];
            }

            // find all causes.
            foreach (ILocalNode cause in NodeManager.GetLocalNodes(source.NodeId, ReferenceTypes.HasCause, false, true))
            {
                MethodSource method = null;

                if (m_causes.TryGetValue(cause.BrowseName, out method))
                {
                    transition.Causes.Add(method);
                }
            }

            // find all effects.
            foreach (ILocalNode effect in NodeManager.GetLocalNodes(source.NodeId, ReferenceTypes.HasEffect, false, true))
            {
                transition.Effects.Add(effect.NodeId);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Contructs the machine by reading the address space.
        /// </summary>
        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();
        }
Beispiel #4
0
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         MethodSource clone = new MethodSource(Server, parent);
         clone.Initialize(this);
         return clone;
     }
 }