Example #1
0
        /// <summary>
        /// Sends the specified signal to the specified state and (optionally) records the transition
        /// </summary>
        /// <param name="receiverStateMethod">The <see cref="MethodInfo"/> that represents the state method
        /// to which to send the signal.</param>
        /// <param name="qSignal">The <see cref="QSignals"/> to send.</param>
        /// <param name="recorder">An instance of <see cref="TransitionChainRecorder"/> if the transition
        /// is to be recorded; <see langword="null"/> otherwise.</param>
        /// <returns>The <see cref="QState"/> returned by the state that recieved the signal.</returns>
        /// <remarks>
        /// Even if a recorder is specified, the transition will only be recorded if the state
        /// <see paramref="receiverStateMethod"/> actually handled it.
        /// This function is used to record the transition chain for a static transition that is executed
        /// the first time.
        /// </remarks>
        private MethodInfo Trigger(MethodInfo receiverStateMethod, QSignals qSignal, TransitionChainRecorder recorder)
        {
            MethodInfo stateMethod = Trigger(receiverStateMethod, qSignal);

            if ((stateMethod == null) && (recorder != null))
            {
                // The receiverState handled the event
                recorder.Record(receiverStateMethod, qSignal);
            }
            return(stateMethod);
        }
Example #2
0
        private MethodInfo Trigger(MethodInfo stateMethod, QSignals qSignal)
        {
            var evt = new QEvent((int)qSignal);

            OnEvent(stateMethod, evt);
            QState state = (QState)stateMethod.Invoke(this, new object[] { evt });

            if (state == null)
            {
                return(null);
            }
            else
            {
                return(state.GetMethodInfo());
            }
        }
Example #3
0
 internal void Record(MethodInfo stateMethod, QSignals qSignal)
 {
     m_TransitionSteps.Add(new TransitionStep(stateMethod, qSignal));
 }
Example #4
0
 internal TransitionStep(MethodInfo stateMethod, QSignals qSignal)
 {
     StateMethod = stateMethod;
     QSignal     = qSignal;
 }
Example #5
0
 internal void Record(MethodInfo stateMethod, QSignals qSignal)
 {
     m_TransitionSteps.Add(new TransitionStep(stateMethod, qSignal));
 }
Example #6
0
 internal TransitionStep(MethodInfo stateMethod, QSignals qSignal)
 {
     StateMethod = stateMethod;
     QSignal = qSignal;
 }
Example #7
0
 /// <summary>
 /// Sends the specified signal to the specified state and (optionally) records the transition
 /// </summary>
 /// <param name="receiverStateMethod">The <see cref="MethodInfo"/> that represents the state method
 /// to which to send the signal.</param>
 /// <param name="qSignal">The <see cref="QSignals"/> to send.</param>
 /// <param name="recorder">An instance of <see cref="TransitionChainRecorder"/> if the transition
 /// is to be recorded; <see langword="null"/> otherwise.</param>
 /// <returns>The <see cref="QState"/> returned by the state that recieved the signal.</returns>
 /// <remarks>
 /// Even if a recorder is specified, the transition will only be recorded if the state 
 /// <see paramref="receiverStateMethod"/> actually handled it.
 /// This function is used to record the transition chain for a static transition that is executed
 /// the first time. 
 /// </remarks>
 private MethodInfo Trigger(MethodInfo receiverStateMethod, QSignals qSignal, TransitionChainRecorder recorder)
 {
     MethodInfo stateMethod = Trigger(receiverStateMethod, qSignal);
     if ((stateMethod == null) && (recorder != null))
     {
         // The receiverState handled the event
         recorder.Record(receiverStateMethod, qSignal);
     }
     return stateMethod;
 }
Example #8
0
 private MethodInfo Trigger(MethodInfo stateMethod, QSignals qSignal)
 {
     QState state = (QState)stateMethod.Invoke(this, new object[] { new QEvent((int)qSignal) } );
     if (state == null)
     {
         return null;
     }
     else
     {
         return state.Method;
     }
 }