]> ruin.nu Git - popboot.git/blob - node.h
parallell
[popboot.git] / node.h
1 #ifndef __node_h__
2 #define __node_h__
3
4 #include <vector>
5 #include <utility>
6 #include "action.h"
7
8 class Node {
9
10         public:
11                 Node(const Action* action);
12                 Node();
13                 Node(const Node& node);
14                 virtual ~Node(){}
15                 void addChild(Node* node);
16                 const Action* action() const;
17                 void execute();
18                 bool executed() const;
19                 const Literals& effects() const;
20                 bool satisfyCondition(std::string effect);
21                 bool satisfyConditions(const Literals& effects);
22                 const std::vector<Node*>& children() const;
23
24         protected:
25                 const Action* _action;
26                 std::vector<Node*> _children;
27                 Preconditions _preconditions;
28                 bool _executed;
29                 Literals _effects;
30 };
31
32 class StartNode :public Node {
33         public:
34                 StartNode(const Literals& init);
35                 ~StartNode(){delete _action;}
36 };
37
38 class EndNode :public Node {
39         public:
40                 EndNode(const Literals& goal);
41                 ~EndNode(){delete _action;}
42 };
43
44 #endif