IStateMachine.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Aitex.Core.RT.Fsm
  6. {
  7. public delegate bool FsmFunc(object[] param);
  8. public interface IStateMachine
  9. {
  10. string Name { get; set; }
  11. int ElapsedTime { get; }
  12. int EnterTime { set; }
  13. int State { get; }
  14. int LastMsg { get; }
  15. int PrevState { get; }
  16. void Init(int initState, int interval);
  17. void Start();
  18. void Loop();
  19. void Stop();
  20. void Transition(int state, int msg, FsmFunc func, int next);
  21. void AnyStateTransition(int msg, FsmFunc func, int next);
  22. void EnterExitTransition(int state, FsmFunc enter, int msg, FsmFunc exit);
  23. void PostMsg(int msg, object[] args);
  24. void PostMsgWithoutLock(int msg, object[] args);
  25. void MapState(int state, string stringState);
  26. void MapMessage(int message, string stringMessage);
  27. bool FindTransition(int state, int msg);
  28. bool CheckExecuted();
  29. bool CheckExecuted(int msg);
  30. bool CheckExecuted(int msg, out int currentMsg, out List<int> msgQueue);
  31. }
  32. }