BcPOC
SF-HRP ASM implementation
D:/bcatch/bcpoc_src/bcpoc/src/sfhrp/SFHRP/plan_parser.hpp
Go to the documentation of this file.
00001 #ifndef _PLAN_PARSER_
00002 #define _PLAN_PARSER_
00003 
00004 #define AGENT_TAG               "agent"
00005 #define SFHRPLAN_TAG    "sfhrplan"
00006 #define COND_TAG                "cond"
00007 #define INIT_TAG                "init"
00008 #define HRPLAN_TAG              "hrplan"
00009 #define CLEANUP_TAG             "cleanup"
00010 #define SFHRPLAN_TAG    "sfhrplan"
00011 #define COND_TAG                "cond"
00012 #define INIT_TAG                "init"
00013 #define HRPLAN_TAG              "hrplan"
00014 #define CLEANUP_TAG             "cleanup"
00015 #define ELEM_TAG                "elem"
00016 #define AND_TAG                 "and"
00017 #define OR_TAG                  "or"
00018 #define NOT_TAG                 "not"
00019 #define TYPE_TAG                "type"
00020 #define PARAM_TAG               "param"
00021 #define PRIO_TAG                "prio"
00022 #define PLAN_TAG                "plan"
00023 #define RULE_TAG                "rule"
00024 #define WEIGHT_TAG              "weight"
00025 #define SUCCESSES_TAG   "successes"
00026 #define FAILS_TAG               "fails"
00027 #define STTOUT_TAG              "sttout"
00028 #define FLAGS_TAG               "flags"
00029 #define INTERSAFE_TAG   "intersafe"
00030 #define RELSAFE_TAG             "relsafe"
00031 #define STICKY_TAG              "sticky"
00032 #define EXEC_TAG                "exec"
00033 #define ACTION_TAG              "action"
00034 #define LIST_TAG                "list"
00035 #define OBJECT_TAG              "object"
00036 #define TERM_TAG                "term"
00037 #define SUCC_TAG                "succ"
00038 #define FAIL_TAG                "fail"
00039 
00040 #define ID_PARAM                "id"
00041 #define NO_ID_PARAM             "no id defined"
00042 #define TYPE_PARAM              "type"
00043 #define TYPE_SUCCESS    "success"
00044 #define TYPE_FAIL               "fail"
00045 #define TYPE_PLAN               "plan"
00046 #define TYPE_ACTION             "action"
00047 
00048 #include <libxml/SAX2.h>
00049 
00050 #include <map>
00051 #include <string>
00052 
00053 #include "condition.hpp"
00054 #include "condition_nodes.hpp"
00055 #include "sf_hrp_plan.hpp"
00056 #include "sf_hrp_asm.hpp"
00057 
00058 #include "i_engine_descriptor.hpp"
00059 
00060 
00061 
00062 class CParserState;
00063 
00064 //#include "ParserLogic.hpp"
00065 //#include "../ReactivePlanner.hpp"
00066 //#include "../action_engine/ActionEngine.hpp"
00067 //#include "../cond_engine/ConditionEngine.hpp"
00068 
00069 class CPlanParser {
00070 public:
00071 
00072         //CPlanParser(ReactivePlanner &, ConditionEngine &, ActionEngine &); //ctor
00073         static CSFHRPASM* Parse(const char*,  IEngineDescriptor* engine); //parsing routine
00074 
00075 
00076         //start element callback header
00077         static void startElement(void *, const xmlChar *, const xmlChar **);
00078 
00079         //end element callback header
00080         static void endElement(void *, const xmlChar *);
00081 
00082         //end element callback header
00083         static void characters(void *, const xmlChar *, int);
00084         
00085 private:
00086 
00087         static void normalize(const xmlChar**, std::map< std::string, std::string> &);
00088         static void xmlCharToString(const xmlChar*, size_t, std::string &);
00089 
00090         static void errorUnexpectedTag(std::string &, CParserState*);
00091         static void errorUnexpectedChars(std::string &, CParserState*);
00092 
00093         //parser context
00094 };
00095 
00096 #endif