C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
cb_state.hpp
Go to the documentation of this file.
1// Copyright (C) 2023 Miguel Ángel González Santamarta
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16#ifndef YASMIN__CB_STATE_HPP_
17#define YASMIN__CB_STATE_HPP_
18
19#include <functional>
20#include <string>
21
22#include "yasmin/blackboard.hpp"
23#include "yasmin/state.hpp"
24#include "yasmin/types.hpp"
25
26namespace yasmin {
27
36class CbState : public State {
37
38private:
41
42public:
47
48
58
72 std::string execute(Blackboard::SharedPtr blackboard) override;
73};
74
75} // namespace yasmin
76
77#endif // YASMIN__CB_STATE_HPP_
std::shared_ptr< Blackboard > SharedPtr
Shared pointer type for Blackboard.
Definition blackboard.hpp:85
std::string execute(Blackboard::SharedPtr blackboard) override
Executes the callback function.
Definition cb_state.cpp:28
CbState(const Outcomes &outcomes, CbStateCallback callback)
Shared pointer type for CbState.
Definition cb_state.cpp:21
CbStateCallback callback
Pointer to the callback function to be executed.
Definition cb_state.hpp:40
Outcomes outcomes
The possible outcomes of this state.
Definition state.hpp:50
State(const Outcomes &outcomes)
Shared pointer type for State.
Definition state.cpp:32
Definition blackboard.hpp:31
StringSet Outcomes
Set of possible outcomes for states.
Definition types.hpp:77
std::function< std::string(std::shared_ptr< Blackboard >)> CbStateCallback
Callback function type for CbState.
Definition types.hpp:107
#define YASMIN_PTR_ALIASES(ClassName)
Macro to define all pointer aliases for a class.
Definition types.hpp:52