IStateMachine.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 EnableRepeatedMsg(bool enable);
  21. void Transition(int state, int msg, FsmFunc func, int next);
  22. void Transition(int state, int msg, FsmFunc func,FsmFunc waitFunc, int next);
  23. void AnyStateTransition(int msg, FsmFunc func, int next);
  24. //void AnyStateTransition(int msg, FsmFunc func, int next, FsmFunc monitorFunc);
  25. void EnterExitTransition(int state, FsmFunc enter, int msg, FsmFunc exit);
  26. void PostMsg(int msg, object[] args);
  27. void PostMsgWithoutLock(int msg, object[] args);
  28. void MapState(int state, string stringState);
  29. void MapMessage(int message, string stringMessage);
  30. bool FindTransition(int state, int msg);
  31. bool CheckExecuted();
  32. bool CheckExecuted(int msg);
  33. bool CheckExecuted(int msg, out int currentMsg, out List<int> msgQueue);
  34. }
  35. }