]> ruin.nu Git - popboot.git/blob - planner.h
55d572877e61641cbdce15d0186bee9b4da9c235
[popboot.git] / planner.h
1 #ifndef __PLANNER_H__
2 #define __PLANNER_H__
3
4 #include <ext/hash_map>
5 #include <vector>
6 #include <queue>
7 #include <pthread.h>
8 #include <semaphore.h>
9 #include "action.h"
10
11 class Node;
12
13 class Planner {
14         public:
15                 Planner(std::vector<Action> actions, Literals init, Literals goal);
16                 ~Planner();
17
18                 void execute();
19
20
21         protected:
22
23                 void makePlan(Node* node);
24                 void addNode(Node* node);
25                 void executePlan();
26                 void replan();
27                 int cleanupExecution();
28                 int executeChildren(Node* node);
29
30                 sem_t _nodes;
31                 sem_t _list;
32                 std::queue<Node*> _executedNodes;
33
34                 Node* _start;
35                 Node* _finish;
36                 __gnu_cxx::hash_map<std::string,Node*> _addedEffects;
37                 __gnu_cxx::hash_map<std::string,Action*> _actionEffects;
38                 Literals _init;
39                 Literals _goal;
40                 std::vector<Node*> _addedNodes;
41                 std::vector<Action*> _actions;
42 };
43 #endif