State.hpp 912 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. namespace ls_std {
  16. class State : public Class {
  17. public:
  18. explicit State(std::string _id);
  19. ~State() = default;
  20. bool addStateConnection(const std::string& _connectionId, const std::shared_ptr<State>& _connectedState);
  21. std::unordered_map<StateConnectionId, std::shared_ptr<State>> getConnectedStates();
  22. std::string getId();
  23. private:
  24. std::unordered_map<std::string, std::shared_ptr<State>> connectedStates {};
  25. std::string id {};
  26. bool _stateIsConnected(const std::string& _id);
  27. };
  28. }
  29. #endif