//parset state #ifndef _PARSER_STATE_ #define _PARSER_STATE_ #include #include #include #include #include class CBaseNode; class IEngineDescriptor; class CCondition; #include "sf_hrp_asm.hpp" #include "reactive_planner.hpp" #include "init_phase.hpp" #include "term_phase.hpp" class CParserState { public: int state; std::stack parent; xmlSAXHandler* ctx; enum { ENTRY_STATE, AGENT, //inside agent tag SFHRPLAN, //inside sfhrplan tag COND, //proceeding conditions - in any part of xml tree INIT, //proceeding init phase HRPLAN, //proceeding hrplan CLEANUP, //proceeding cleanup TERM, //proceeding termination PRIO, //proceeding priority of the rule or plan //condition states C_ELEM, //inside conditions element C_AND, //conditions operator C_OR, //conditions operator C_NOT, //conditions operator TYPE, //conditions element or action type PARAM, // -//- param PLAN, //inside plan tag RULE, //inside rule tag WEIGHT, //proceedin weight of the rule SUCCS, FAILS, STTOUT, FLAGS, STICKY, //sticky flag INTERSAFE, // interuption safe flag RELSAFE, //re;leaser safe flag EXEC_S, //exec success EXEC_F, //exec fail EXEC_P, //inside exec plan EXEC_A, //inside exec actions ACTION, //inside action element LIST, //initialization object list OBJECT, //initialization object SUCC, //termination success case FAIL, //termination fail case FATAL_ERROR //aborting parser }; //type and params of action and condition std::string type; std::vector< std::string > params; std::stack< CNodeBase* > nodes; //engine context IEngineDescriptor* engine; std::stack< CCondition* > conditions; CSFHRPASM* agent; int priority; InitPhase* iphase; ReactivePlanner* rplanner; TermPhase* tphase; SimplePlan* actualPlan; ptrSimplePlan EnsurePlan( std::string & plan); std::map< std::string, ptrSimplePlan> plans; //rule attributes unsigned int weight; unsigned int flags; unsigned int sticky_timeout; unsigned int successes, fails; int execType; int actualAction; std::string ruleplan; //id of plan when plan rule std::vector< int> actions; std::vector< std::string> objects; std::string term_succ; std::string term_fail; bool error; //element name/id stack std::stack< std::string> ids; }; #endif