Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef PREDICATESSCRIPT_H_
00009 #define PREDICATESSCRIPT_H_
00010
00011 #include <iostream>
00012 #include <boost/regex.hpp>
00013 #include <boost/foreach.hpp>
00014 #include <boost/algorithm/string.hpp>
00015
00016 #include "PythonScript.h"
00017
00018 #define foreach BOOST_FOREACH
00019
00020 using namespace std;
00021
00022 class PredicatesScript
00023 {
00024 public:
00030 PredicatesScript(string script, set<string>& internalFunctions);
00031
00036 string getSourceScript() { return _sourceScript; }
00037
00042 string getTranslatedScript() { return _translatedScript; }
00043
00048 string getName() { return _name; }
00049
00054 PythonScript getPythonScript() { return PythonScript(_name, getTranslatedScript(), _parameters); }
00055
00061 string getParameter(string name) {
00062 return (_parameters.count(name) > 0) ? _parameters[name] : "";
00063 }
00064
00069 void addInternalFunction(string functionName) { if (_internalFunctions.count(functionName) == 0) _internalFunctions.insert(functionName); }
00070
00071 private:
00072
00077 void processParameters(string& script);
00078
00084 void processTopics(string& script);
00085
00090 void processPredicates(string& script);
00091
00096 void processInternalFunctions(string& script);
00097
00103 bool addParameter(const boost::match_results<std::string::const_iterator>& paramMatch);
00104
00105 string _sourceScript;
00106 string _translatedScript;
00107 string _name;
00108 map<string, string> _parameters;
00109 set<string> _internalFunctions;
00110 };
00111
00112 #endif