module.h
Go to the documentation of this file.
00001 #ifndef MODULE_H_
00002 #define MODULE_H_
00003 
00004 #include <vector>
00005 #include <string>
00006 #include <iostream>
00007 #include <fstream>
00008 #include "pddlModuleLoaderLDL.h"
00009 #include "tfd_modules/module_api/pddlModuleTypes.h"
00010 #include "tfd_modules/module_api/OplCallbackInterface.h"
00011 #include <tr1/unordered_map>
00012 #include <tr1/tuple>
00013 #include <string.h>
00014 using namespace std;
00015 using namespace modules;
00016 
00017 class TimeStampedState;
00018 struct PlanStep;
00019 
00020 class Module
00021 {
00022     public:
00023         string libCall;
00024         //string function_name;
00025         //string lib;
00026         ParameterList params;
00027 
00028         Module(istream &in);
00029         Module(string _libCall) :
00030             libCall(_libCall)
00031         {
00032         }
00033         Module()
00034         {
00035         }
00036         virtual ~Module();
00037 
00038         virtual void dump();
00039 };
00040 
00041 class ConditionModule: public Module
00042 {
00043     public:
00044         int var;
00045 
00046         conditionCheckerType checkCondition;
00047 
00048         ConditionModule(istream &in);
00049         
00050         virtual void dump();
00051 };
00052 
00053 class EffectModule: public Module
00054 {
00055     public:
00056         string internal_name;
00057         vector<int> writtenVars;
00058 
00059         applyEffectType applyEffect;
00060 
00061         EffectModule(istream &in);
00062         
00063         virtual void dump();
00064 };
00065 
00066 class CostModule: public Module
00067 {
00068     public:
00069         int var;
00070 
00071         conditionCheckerType checkCost;
00072 
00073         CostModule(istream &in);
00074         
00075         virtual void dump();
00076 };
00077 
00078 class InitModule: public Module
00079 {
00080     public:
00081         vector<string> parameters;
00082 
00083         InitModule(istream &in);
00084         void execInit();
00085 
00086         moduleInitType initModule;
00087 };
00088 
00089 class OplInit: public Module
00090 {
00091 public:
00092     OplInit(istream &in);
00093     opl::interface::OplCallbackInterface* execInit(const ObjectTypeMap& objects,
00094             const PredicateMapping& predicateMapping,
00095             const FunctionMapping& functionMapping,
00096             const modules::PredicateList& predicateConstants,
00097             const modules::NumericalFluentList& numericConstants);
00098 
00099     oplCallbackInitType oplInit;
00100 };
00101 
00102 // Module Interfacing functions and data
00103 void dump_modules();
00104 
00105 // modules
00106 extern const TimeStampedState* g_modulecallback_state;
00107 extern map<int, ConditionModule*> g_condition_modules;
00108 extern vector<EffectModule *> g_effect_modules;
00109 extern map<int, CostModule*> g_cost_modules;
00110 extern vector<InitModule *> g_init_modules;
00111 extern OplInit* g_oplinit;
00112 extern opl::interface::OplCallbackInterface* g_OplModuleCallback;
00113 
00114 // subplan generation
00115 typedef tr1::tuple<Module*, Module*, Module*> SubplanModuleSet;
00116 extern vector<SubplanModuleSet> g_subplan_modules;
00117 
00118 void handleSubplans(const vector<PlanStep> & plan);
00119 
00120 extern PredicateMapping g_pred_mapping;
00121 extern FunctionMapping g_func_mapping;
00122 
00123 extern modules::PredicateList g_pred_constants;
00124 extern modules::NumericalFluentList g_func_constants;
00125 
00126 // callback functions
00127 void g_setModuleCallbackState(const TimeStampedState* currentState);
00128 bool getPreds(modules::PredicateList* & predicateList); // (*predicateCallbackType)
00129 bool getFuncs(modules::NumericalFluentList* & fluentList); // (*numericalFluentCallbackType)
00130 
00131 // Module loader
00132 extern PDDLModuleLoader *g_module_loader;
00133 
00134 // Parsing
00135 void read_pddl_translation(istream &in);
00136 void read_constant_facts(istream& in);
00137 void read_modules(istream &in);
00138 
00139 void read_oplinits(istream &in);
00140 void read_objects(istream &in);
00141 
00142 #endif /* MODULE_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


tfd_modules
Author(s): Maintained by Christian Dornhege (see AUTHORS file).
autogenerated on Tue Jan 22 2013 12:25:03