Atm_fan.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <Automaton.h>
  3. class Atm_fan : public Machine {
  4. public:
  5. enum { IDLE, SEND }; // STATES
  6. enum { EVT_INPUT, ELSE }; // EVENTS
  7. Atm_fan( void ) : Machine(){};
  8. Atm_fan& begin( void );
  9. Atm_fan& trace( Stream& stream );
  10. Atm_fan& trigger( int event );
  11. int state( void );
  12. Atm_fan& onInput( Machine& machine, int event = 0 );
  13. Atm_fan& onInput( atm_cb_push_t callback, int idx = 0 );
  14. private:
  15. enum { ENT_SEND }; // ACTIONS
  16. enum { ON_INPUT, CONN_MAX = 4 }; // CONNECTORS
  17. atm_connector connectors[CONN_MAX];
  18. int event( int id );
  19. void action( int id );
  20. };
  21. /*
  22. Automaton::ATML::begin - Automaton Markup Language
  23. <?xml version="1.0" encoding="UTF-8"?>
  24. <machines>
  25. <machine name="Atm_fan">
  26. <states>
  27. <IDLE index="0" sleep="1">
  28. <EVT_INPUT>SEND</EVT_INPUT>
  29. </IDLE>
  30. <SEND index="1" on_enter="ENT_SEND">
  31. <ELSE>IDLE</ELSE>
  32. </SEND>
  33. </states>
  34. <events>
  35. <EVT_INPUT index="0"/>
  36. </events>
  37. <connectors>
  38. <INPUT autostore="1" broadcast="1" dir="PUSH" slots="4"/>
  39. </connectors>
  40. <methods>
  41. </methods>
  42. </machine>
  43. </machines>
  44. Automaton::ATML::end
  45. */