#ifndef _SFHRPPLAN_ #define _SFHRPPLAN_ #include "i_engine_descriptor.hpp" #include "i_releaseable.hpp" #include "reactive_planner.hpp" #include "init_phase.hpp" #include "term_phase.hpp" class CSFHRPASM; class CCondition; /** * Single top level plan */ class CSFHRPPlan : public IReleaseable { public: /** * Ctor */ CSFHRPPlan(CSFHRPASM*, IEngineDescriptor *, int, CCondition*, InitPhase*, ReactivePlanner*, TermPhase*); /** * Dtor */ ~CSFHRPPlan(); /** * Get appropriate action acording to the state */ int GetAction(); /** * Get priority of plan */ int GetPriority(); /** * from IReleasable */ void Activate(); /** * from IReleasable */ void Deactivate(); /** * Whether plan was switched out and can be executed another */ bool IsSwitched(); /** * Initiate switch out of the plan * * if there is no switch out, go directly to the switched phase */ void SwitchOut(); /** * Initiate switch out of the plan * * if there is no switch out, go directly to the switched phase */ void SwitchIn(); /** * Whether is plan holding */ bool IsActive(); private: /** * Current state */ int m_state; /** * Priority of the plan */ int m_prio; /** * Init phase - init phase ASM */ InitPhase* m_init; /** * Reactive planner - execution phase ASM */ ReactivePlanner* m_rplanner; /** * Terminatio phase */ TermPhase* m_term; /** * Plan condition */ CCondition* m_condition; /** * Parent agent of the plan */ CSFHRPASM* m_agent; /** * Engine descriptor */ IEngineDescriptor* m_engineDescriptor; /** * Plan states */ enum { INITIALIZATION, EXECUTION, TERMINATION, FINISHED, SWITCHING_OUT, SWITCHING_IN, SWITCHED } states; }; #endif