BcPOC
SF-HRP ASM implementation
|
00001 //parset state 00002 00003 #ifndef _PARSER_STATE_ 00004 #define _PARSER_STATE_ 00005 00006 #include <stack> 00007 #include <map> 00008 #include <string> 00009 #include <vector> 00010 00011 #include <libxml/SAX2.h> 00012 00013 class CBaseNode; 00014 class IEngineDescriptor; 00015 class CCondition; 00016 00017 #include "sf_hrp_asm.hpp" 00018 #include "reactive_planner.hpp" 00019 #include "init_phase.hpp" 00020 #include "term_phase.hpp" 00021 00022 00023 class CParserState { 00024 public: 00025 int state; 00026 std::stack<int> parent; 00027 00028 xmlSAXHandler* ctx; 00029 00030 enum { 00031 ENTRY_STATE, 00032 AGENT, //inside agent tag 00033 SFHRPLAN, //inside sfhrplan tag 00034 COND, //proceeding conditions - in any part of xml tree 00035 INIT, //proceeding init phase 00036 HRPLAN, //proceeding hrplan 00037 CLEANUP, //proceeding cleanup 00038 TERM, //proceeding termination 00039 PRIO, //proceeding priority of the rule or plan 00040 00041 //condition states 00042 C_ELEM, //inside conditions element 00043 C_AND, //conditions operator 00044 C_OR, //conditions operator 00045 C_NOT, //conditions operator 00046 00047 TYPE, //conditions element or action type 00048 PARAM, // -//- param 00049 00050 PLAN, //inside plan tag 00051 RULE, //inside rule tag 00052 00053 WEIGHT, //proceedin weight of the rule 00054 SUCCS, 00055 FAILS, 00056 STTOUT, 00057 FLAGS, 00058 STICKY, //sticky flag 00059 INTERSAFE, // interuption safe flag 00060 RELSAFE, //re;leaser safe flag 00061 00062 EXEC_S, //exec success 00063 EXEC_F, //exec fail 00064 EXEC_P, //inside exec plan 00065 EXEC_A, //inside exec actions 00066 00067 ACTION, //inside action element 00068 00069 LIST, //initialization object list 00070 OBJECT, //initialization object 00071 00072 SUCC, //termination success case 00073 FAIL, //termination fail case 00074 00075 FATAL_ERROR //aborting parser 00076 00077 00078 }; 00079 00080 //type and params of action and condition 00081 std::string type; 00082 std::vector< std::string > params; 00083 std::stack< CNodeBase* > nodes; 00084 00085 //engine context 00086 IEngineDescriptor* engine; 00087 std::stack< CCondition* > conditions; 00088 CSFHRPASM* agent; 00089 int priority; 00090 InitPhase* iphase; 00091 ReactivePlanner* rplanner; 00092 TermPhase* tphase; 00093 SimplePlan* actualPlan; 00094 00095 ptrSimplePlan EnsurePlan( std::string & plan); 00096 std::map< std::string, ptrSimplePlan> plans; 00097 00098 //rule attributes 00099 unsigned int weight; 00100 unsigned int flags; 00101 unsigned int sticky_timeout; 00102 unsigned int successes, fails; 00103 00104 int execType; 00105 int actualAction; 00106 00107 std::string ruleplan; //id of plan when plan rule 00108 00109 std::vector< int> actions; 00110 00111 std::vector< std::string> objects; 00112 00113 std::string term_succ; 00114 std::string term_fail; 00115 00116 bool error; 00117 00118 //element name/id stack 00119 std::stack< std::string> ids; 00120 00121 }; 00122 00123 #endif