00001 #ifndef AXIOM_H 00002 #define AXIOM_H 00003 00004 #include <iostream> 00005 #include <fstream> 00006 #include <string> 00007 #include <vector> 00008 using namespace std; 00009 00010 class Variable; 00011 00012 struct Condition 00013 { 00014 Variable *var; 00015 int cond; 00016 Condition(Variable *v, int c) : 00017 var(v), cond(c) 00018 { 00019 } 00020 }; 00021 00022 class Axiom_relational 00023 { 00024 public: 00025 00026 private: 00027 Variable *effect_var; 00028 int old_val; 00029 int effect_val; 00030 vector<Condition> conditions; // var, val 00031 public: 00032 Axiom_relational(istream &in, const vector<Variable *> &variables); 00033 00034 bool is_redundant() const; 00035 void dump() const; 00036 void generate_cpp_input(ostream &outfile) const; 00037 const vector<Condition> &get_conditions() const { 00038 return conditions; 00039 } 00040 Variable* get_effect_var() const { 00041 return effect_var; 00042 } 00043 int get_old_val() const { 00044 return old_val; 00045 } 00046 int get_effect_val() const { 00047 return effect_val; 00048 } 00049 }; 00050 00051 class Axiom_functional 00052 { 00053 public: 00054 00055 private: 00056 Variable *effect_var; 00057 Variable *left_var; 00058 Variable *right_var; 00059 bool comparison; 00060 public: 00061 foperator fop; 00062 compoperator cop; 00063 Axiom_functional(istream &in, const vector<Variable *> &variables, 00064 bool comparison); 00065 00066 bool is_redundant() const; 00067 00068 void dump() const; 00069 void generate_cpp_input(ostream &outfile) const; 00070 Variable* get_effect_var() const { 00071 return effect_var; 00072 } 00073 Variable* get_left_var() const { 00074 return left_var; 00075 } 00076 Variable* get_right_var() const { 00077 return right_var; 00078 } 00079 foperator get_operator() const { 00080 return fop; 00081 } 00082 void set_operator(foperator _fop) { 00083 fop = _fop; 00084 } 00085 bool is_comparison() const { 00086 return comparison; 00087 } 00088 void set_comparison() { 00089 comparison = true; 00090 } 00091 }; 00092 00093 extern void strip_Axiom_relationals(vector<Axiom_relational> &axioms_rel); 00094 00095 extern void strip_Axiom_functionals(vector<Axiom_functional> &axioms_func); 00096 00097 #endif