State.hpp 967 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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-05
  7. *
  8. * */
  9. #ifndef LS_STD_STATE_HPP
  10. #define LS_STD_STATE_HPP
  11. #include <memory>
  12. #include <list>
  13. #include "../base/Class.hpp"
  14. namespace ls_std {
  15. class State : public Class {
  16. public:
  17. explicit State(std::string _id);
  18. ~State() = default;
  19. bool addStateConnection(const std::shared_ptr<State>& _connectedState);
  20. std::list<std::shared_ptr<State>> getConnectedStates();
  21. std::string getId();
  22. bool isAccessible() const;
  23. void removeStateConnection(const std::string& _id);
  24. void updateAccessCondition(bool _enteredCondition);
  25. private:
  26. bool accessCondition {};
  27. std::list<std::shared_ptr<State>> connectedStates {};
  28. std::string id {};
  29. bool _stateIsConnected(const std::string& _id);
  30. };
  31. }
  32. #endif