123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-09-05
- * Changed: 2022-07-03
- *
- * */
- #ifndef LS_STD_STATE_HPP
- #define LS_STD_STATE_HPP
- #include <memory>
- #include <unordered_map>
- #include <ls_std/core/Class.hpp>
- #include <ls_std/core/types/StateMachineTypes.hpp>
- #include "StateConnection.hpp"
- #include <ls_std/core/interface/ISerializable.hpp>
- #include <ls_std/os/dynamic_goal.hpp>
- namespace ls::std::logic
- {
- class LS_STD_DYNAMIC_GOAL State : public ls::std::core::Class
- {
- public:
- explicit State(const ls::std::core::type::state_id &_id);
- ~State() override = default;
- // additional functionality
- bool addStateConnection(const ls::std::core::type::state_connection_id &_connectionId, const ::std::shared_ptr<ls::std::logic::State> &_connectedState);
- bool addStateConnection(const ::std::shared_ptr<ls::std::logic::StateConnection> &_connection);
- void clearConnections();
- ::std::unordered_map<ls::std::core::type::state_connection_id, ::std::shared_ptr<ls::std::logic::StateConnection>> getConnectedStates();
- ls::std::core::type::state_id getId();
- bool hasConnection(const ls::std::core::type::state_connection_id &_connectionId);
- void setId(const ls::std::core::type::state_id &_id);
- private:
- ::std::unordered_map<ls::std::core::type::state_connection_id, ::std::shared_ptr<ls::std::logic::StateConnection>> connectedStates{};
- ls::std::core::type::state_id id{};
- void _assignStateId(const ls::std::core::type::state_id &_id);
- void _clearConnections();
- bool _hasConnection(const ls::std::core::type::state_connection_id &_connectionId);
- };
- }
- #endif
|