123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- namespace ls::std::logic
- {
- class LS_STD_DYNAMIC_GOAL StateMachine : public ls::std::core::Class
- {
- public:
- explicit StateMachine(const ::std::string &_name);
- ~StateMachine() override = default;
- bool addState(const ::std::shared_ptr<ls::std::logic::State> &_state);
- ::std::shared_ptr<ls::std::logic::State> getCurrentState();
- ::std::vector<ls::std::core::type::state_id> getMemory();
- ::std::string getName();
- ::std::unordered_map<ls::std::core::type::state_id, ::std::shared_ptr<ls::std::logic::State>> getStates();
- bool hasState(const ls::std::core::type::state_id &_id);
- bool proceed();
- void setMemory(const ::std::vector<ls::std::core::type::state_id> &_memory);
- void setName(const ::std::string &_name);
- bool setStartState(const ls::std::core::type::state_id &_id);
- private:
- ::std::shared_ptr<ls::std::logic::State> currentState{};
- ::std::vector<ls::std::core::type::state_id> memory{};
- ::std::string name{};
- ::std::unordered_map<ls::std::core::type::state_id, ::std::shared_ptr<ls::std::logic::State>> states{};
- void _assignMemory(const ::std::vector<ls::std::core::type::state_id> &_memory);
- void _assignName(const ::std::string &_name);
- ::std::vector<ls::std::core::type::state_id> _getNextValidStates();
- void _remember(const ls::std::core::type::state_id &_id);
- bool _hasState(const ls::std::core::type::state_id &_id);
- };
- }
|