State.hpp 959 B

123456789101112131415161718192021222324252627282930313233343536373839
  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-10
  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. private:
  25. std::unordered_map<StateConnectionId, std::shared_ptr<StateConnection>> connectedStates {};
  26. StateId id {};
  27. bool _stateIsConnected(const StateId& _id);
  28. };
  29. }
  30. #endif