20 #ifndef HEDGEHOG_STATE_MANAGER_H 21 #define HEDGEHOG_STATE_MANAGER_H 23 #include "../abstract_task.h" 24 #include "abstract_state.h" 29 #if defined (__clang__) 30 #pragma clang diagnostic push 31 #pragma clang diagnostic ignored "-Woverloaded-virtual" 40 template<
class StateOutput,
class ...StateInputs>
65 template<
class StateInput,
class StateOutput,
class ...StateInputs>
82 void execute(std::shared_ptr<StateInput> input)
final {
85 while (!this->es_->readyList()->empty()) { this->
addResult(this->es_->frontAndPop()); }
91 #if defined (__clang__) 92 #pragma clang diagnostic pop 116 template<
class StateOutput,
class ...StateInputs>
120 std::shared_ptr<
AbstractState<StateOutput, StateInputs...>> state_ =
nullptr;
136 class IsCompatibleState =
typename std::enable_if_t<
137 std::is_base_of_v<
AbstractState<StateOutput, StateInputs...>, StateType>
141 behavior::StateManagerExecuteDefinition<StateInputs, StateOutput, StateInputs...>(state)...,
153 class IsCompatibleState =
typename std::enable_if_t<
154 std::is_base_of_v<
AbstractState<StateOutput, StateInputs...>, StateType>
158 behavior::StateManagerExecuteDefinition<StateInputs, StateOutput, StateInputs...>(state)...,
173 class IsCompatibleState =
typename std::enable_if_t<
174 std::is_base_of_v<
AbstractState<StateOutput, StateInputs...>, StateType>
178 std::shared_ptr<StateType>
const state,
180 behavior::StateManagerExecuteDefinition<StateInputs, StateOutput, StateInputs...>(state)..., state_(state) {
181 this->
core()->name(name);
188 return std::make_shared<
StateManager<StateOutput, StateInputs...>>(this->
name(),
199 #endif //HEDGEHOG_STATE_MANAGER_H std::shared_ptr< AbstractState< StateOutput, StateInputs... > > const & state() const
Managed state accessor.
Base node for computation.
void execute(std::shared_ptr< StateInput > input) final
Default execute method definition.
StateManagerExecuteDefinition(std::shared_ptr< AbstractState< StateOutput, StateInputs... >> const &state)
Constructor for an AbstractStateManager with name, state, and automaticStart as mandatory parameters...
void addResult(std::shared_ptr< StateOutput > output)
Add an output data.
Implementation of the execute method for the StateManager.
std::shared_ptr< AbstractTask< StateOutput, StateInputs... > > copy() override
Default override of the copy method, copy the name, the state and the automatic start.
std::shared_ptr< core::CoreNode > core() final
Task's core accessor.
std::shared_ptr< AbstractState< StateOutput, StateInputs... > > es_
State used in execute definition.
Base State Manager, needed to avoid virtual inheritance of AbstractTask.
StateManager(std::string_view const name, std::shared_ptr< StateType > const state, bool automaticStart=false)
Constructor for a StateManager with name and state as mandatory parameter, and automatic start as opt...
StateManager(std::shared_ptr< StateType > const state, bool automaticStart)
Constructor for an StateManager with state and automatic start as mandatory parameter.
Hedgehog graph's node, used to manage an AbstractState.
StateManager(std::shared_ptr< StateType > const state)
Constructor for a StateManager with state as mandatory parameter.
State Interface for managing computation, need a corresponding AbstractStateManager to be embedded in...
BaseStateManager()
DEfault constructor, set the base property for a state manager.
Execute Behavior definition, node that has an execution for an Input data type.
std::string_view name()
Task's name accessor.
bool automaticStart()
Task's automatic start accessor.
virtual void execute(std::shared_ptr< TaskInputs >)=0
Virtual declaration of execute function for a data of type Input.