State.hpp 990 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-05
  6. * Changed: 2020-09-14
  7. *
  8. * */
  9. #ifndef LS_STD_STATE_HPP
  10. #define LS_STD_STATE_HPP
  11. #include <memory>
  12. #include <unordered_map>
  13. #include "../base/Class.hpp"
  14. #include "StateMachineTypes.hpp"
  15. #include "StateConnection.hpp"
  16. namespace ls_std {
  17. class State : public Class {
  18. public:
  19. explicit State(StateId _id);
  20. ~State() = default;
  21. bool addStateConnection(const StateConnectionId& _connectionId, const std::shared_ptr<State>& _connectedState);
  22. std::unordered_map<StateConnectionId, std::shared_ptr<StateConnection>> getConnectedStates();
  23. StateId getId();
  24. void setId(StateId _id);
  25. private:
  26. std::unordered_map<StateConnectionId, std::shared_ptr<StateConnection>> connectedStates {};
  27. StateId id {};
  28. bool _stateIsConnected(const StateId& _id);
  29. };
  30. }
  31. #endif