-
Notifications
You must be signed in to change notification settings - Fork 10
/
domains.h
134 lines (103 loc) · 3.85 KB
/
domains.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Copyright (C) 2002--2005 Carnegie Mellon University
// Copyright (C) 2019 Google Inc
//
// This file is part of VHPOP.
//
// VHPOP is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// VHPOP is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VHPOP; if not, write to the Free Software Foundation,
// Inc., #59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Domain descriptions.
#ifndef DOMAINS_H
#define DOMAINS_H
#include <map>
#include "actions.h"
#include "functions.h"
#include "predicates.h"
#include "terms.h"
#include "types.h"
#include "src/pddl-requirements.h"
/* ====================================================================== */
/* Domain */
/*
* Domain definition.
*/
struct Domain {
/* Table of domain definitions. */
struct DomainMap : public std::map<std::string, const Domain*> {
};
/* Requirements for this domain. */
PddlRequirements requirements;
/* Returns a const_iterator pointing to the first domain. */
static DomainMap::const_iterator begin();
/* Returns a const_iterator pointing beyond the last domain. */
static DomainMap::const_iterator end();
/* Returns the domain with the given name, or NULL it is undefined. */
static const Domain* find(const std::string& name);
/* Removes all defined domains. */
static void clear();
/* Constructs an empty domain with the given name. */
Domain(const std::string& name);
/* Deletes a domain. */
~Domain();
/* Returns the name of this domain. */
const std::string& name() const { return name_; }
/* Domain actions. */
const std::map<std::string, const ActionSchema*>& actions() const {
return actions_;
}
/* Returns the type table of this domain. */
TypeTable& types() { return types_; }
/* Returns the type table of this domain. */
const TypeTable& types() const { return types_; }
/* Returns the predicate table of this domain. */
PredicateTable& predicates() { return predicates_; }
/* Returns the predicate table of this domain. */
const PredicateTable& predicates() const { return predicates_; }
/* Returns the function table of this domain. */
FunctionTable& functions() { return functions_; }
/* Returns the function table of this domain. */
const FunctionTable& functions() const { return functions_; }
/* Returns the `total-time' function. */
const Function& total_time() const { return total_time_; }
/* Returns the term table of this domain. */
TermTable& terms() { return terms_; }
/* Returns the term table of this domain. */
const TermTable& terms() const { return terms_; }
/* Adds an action to this domain. */
void add_action(const ActionSchema& action);
/* Returns the action schema with the given name, or NULL if it is
undefined. */
const ActionSchema* find_action(const std::string& name) const;
private:
/* Table of all defined domains. */
static DomainMap domains;
/* Name of this domain. */
std::string name_;
/* Domain types. */
TypeTable types_;
/* Domain predicates. */
PredicateTable predicates_;
/* Domain functions. */
FunctionTable functions_;
/* The `total-time' function. */
Function total_time_;
/* Domain terms. */
TermTable terms_;
/* Domain action schemas. */
std::map<std::string, const ActionSchema*> actions_;
friend std::ostream& operator<<(std::ostream& os, const Domain& d);
};
/* Output operator for domains. */
std::ostream& operator<<(std::ostream& os, const Domain& d);
#endif /* DOMAINS_H */