00001 00002 #ifndef actasp_action_util_h__guard 00003 #define actasp_action_util_h__guard 00004 00005 #include <actasp/Action.h> 00006 #include <actasp/AnswerSet.h> 00007 00008 #include <list> 00009 #include <utility> 00010 #include <set> 00011 #include <functional> 00012 00013 namespace actasp { 00014 00015 struct ActionDeleter { 00016 void operator()(Action *act) const { 00017 delete act; 00018 } 00019 }; 00020 00021 struct ActionMapDeepCopy { 00022 00023 std::pair<std::string, Action *> operator()(const std::pair<std::string, Action *> &other) { 00024 00025 return std::make_pair(other.first, other.second->clone()); 00026 } 00027 }; 00028 00029 struct ActionMapDelete { 00030 00031 void operator()(const std::pair<std::string, Action *> &other) { 00032 delete other.second; 00033 } 00034 }; 00035 00036 struct IsAnAction : public std::unary_function<const AspFluent&,bool>{ 00037 00038 IsAnAction(const ActionSet& actions); 00039 00040 bool operator()(const AspFluent& fluent) const; 00041 00042 std::set<std::string> actionNames; 00043 }; 00044 00045 AnswerSet planToAnswerSet(const std::list<Action*>& plan); 00046 00047 ActionSet actionMapToSet(const std::map<std::string, Action *>& actionMap); 00048 00049 } 00050 00051 00052 #endif