Go to the documentation of this file.00001 #ifndef ACTION_EXECUTOR_INTERFACE_H
00002 #define ACTION_EXECUTOR_INTERFACE_H
00003
00004 #include "plan.h"
00005 #include "symbolicState.h"
00006 #include <deque>
00007 #include <string>
00008 #include <sstream>
00009 #include <iostream>
00010
00011 namespace continual_planning_executive
00012 {
00013
00015 class ActionExecutorInterface
00016 {
00017 public:
00018 ActionExecutorInterface() {}
00019 virtual ~ActionExecutorInterface() {}
00020
00022 virtual void initialize(const std::deque<std::string> & arguments) {}
00023
00025
00029 virtual bool canExecute(const DurativeAction & a, const SymbolicState & currentState) const = 0;
00030
00032
00036 virtual bool executeBlocking(const DurativeAction & a, SymbolicState & currentState) = 0;
00037
00038
00039
00041 virtual void cancelAction() = 0;
00042 };
00043
00045 inline bool splitNamedId(const string & namedId, string & name, int & id)
00046 {
00047 string::size_type foundIdx = namedId.find_first_of("0123456789");
00048 if(foundIdx == string::npos)
00049 return false;
00050
00051 name = namedId.substr(0, foundIdx);
00052
00053 std::stringstream ss(namedId.substr(foundIdx));
00054 ss >> id;
00055 return true;
00056 }
00057
00058 };
00059
00060 #endif
00061