]> ruin.nu Git - popboot.git/blob - node.h
including iterator
[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                 const Preconditions& preconditions() const;
24
25         protected:
26                 const Action* _action;
27                 std::vector<Node*> _children;
28                 Preconditions _preconditions;
29                 bool _executed;
30                 Literals _effects;
31 };
32
33 class StartNode :public Node {
34         public:
35                 StartNode(const Literals& init);
36                 ~StartNode(){delete _action;}
37 };
38
39 class EndNode :public Node {
40         public:
41                 EndNode(const Literals& goal);
42                 ~EndNode(){delete _action;}
43 };
44
45 #endif