00001 #ifndef actasp_AnswerSet_h__guard 00002 #define actasp_AnswerSet_h__guard 00003 00004 #include <actasp/AspFluent.h> 00005 00006 #include <string> 00007 #include <set> 00008 #include <list> 00009 #include <map> 00010 #include <vector> 00011 #include <algorithm> 00012 #include <stdexcept> 00013 00014 namespace actasp { 00015 00016 class Action; 00017 00018 class AnswerSet { 00019 00020 public: 00021 00022 AnswerSet() : satisfied(false), fluents() {} 00023 00024 template <typename Iterator> 00025 AnswerSet(Iterator from, Iterator to) throw() : satisfied(true), fluents(from,to) { 00026 std::sort(fluents.begin(), fluents.end(), TimeStepComparator()); 00027 } 00028 00029 typedef std::vector<actasp::AspFluent> FluentSet; 00030 00031 bool isSatisfied() const throw(); 00032 00033 bool contains(const actasp::AspFluent& fluent) const throw(); 00034 00035 std::list<Action *> instantiateActions(const std::map<std::string, actasp::Action*> &actionMap) const throw(std::logic_error); 00036 00037 const FluentSet& getFluents() const throw() { return fluents;} 00038 00039 std::set<actasp::AspFluent> getFluentsAtTime(unsigned int timeStep) const throw(); 00040 00041 unsigned int maxTimeStep() const throw(std::logic_error); 00042 00043 private: 00044 00045 bool satisfied; 00046 FluentSet fluents; 00047 }; 00048 00049 } 00050 #endif