00001 #ifndef actasp_Action_h__guard 00002 #define actasp_Action_h__guard 00003 00004 #include <actasp/AspFluent.h> 00005 00006 #include <string> 00007 #include <vector> 00008 00009 namespace actasp { 00010 00011 struct Action { 00012 00013 virtual int paramNumber() const = 0; 00014 00015 virtual std::string getName() const = 0; 00016 00017 virtual void run() = 0; 00018 00019 virtual bool hasFinished() const = 0; 00020 00021 virtual bool hasFailed() const {return false;} 00022 00023 virtual Action *cloneAndInit(const actasp::AspFluent & fluent) const =0; 00024 00025 virtual Action *clone() const =0; 00026 00027 std::string toASP(unsigned int timeStep) const; 00028 00029 AspFluent toFluent(unsigned int timeStep) const; 00030 00031 bool operator==(const Action *other) const { 00032 return this->toASP(0) == other->toASP(0); 00033 } 00034 00035 bool operator<(const Action *other) const { 00036 return this->toASP(0) < other->toASP(0); 00037 } 00038 00039 virtual ~Action() {} 00040 00041 private: 00042 00043 virtual std::vector<std::string> getParameters() const = 0; 00044 }; 00045 00046 } 00047 00048 #endif