Fawkes API
Fawkes Development Version
node_constraint.cpp
1
/***************************************************************************
2
* node_constraint.cpp - base class for nod constraints
3
*
4
* Created: Sun Mar 02 10:47:35 2014
5
* Copyright 2014 Sebastian Reuter
6
* 2014 Tim Niemueller
7
****************************************************************************/
8
9
/* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Library General Public License for more details.
18
*
19
* Read the full text in the LICENSE.GPL file in the doc directory.
20
*/
21
22
#include <navgraph/constraints/node_constraint.h>
23
24
namespace
fawkes
{
25
26
/** @class NavGraphNodeConstraint <navgraph/constraints/node_constraint.h>
27
* Constraint that can be queried to check if a node is blocked.
28
* @author Sebastian Reuter
29
* @author Tim Niemueller
30
*
31
* @fn bool NavGraphNodeConstraint::blocks(fawkes::NavGraphNode &node) throw() = 0
32
* Check if constraint blocks a node.
33
* This method must be implemented by constraint classes. It is called
34
* to determine if a node should be considered blocked and therefore
35
* cannot be expanded during path search. Note that the method may not
36
* throw an exception. Handle this internally appropriately.
37
* @param node node to check for expansion
38
* @return true if the node should be considered blocked, false otherwise
39
*
40
* @var std::string NavGraphNodeConstraint::name_
41
* Name of constraint.
42
*/
43
44
/** Constructor.
45
* @param name name of node constraint
46
*/
47
NavGraphNodeConstraint::NavGraphNodeConstraint
(
const
std::string &name)
48
{
49
name_
=
name
;
50
}
51
52
/** Constructor.
53
* @param name name of node constraint
54
*/
55
NavGraphNodeConstraint::NavGraphNodeConstraint
(
const
char
*name)
56
{
57
name_
=
name
;
58
}
59
60
/** Virtual empty destructor. */
61
NavGraphNodeConstraint::~NavGraphNodeConstraint
()
62
{
63
}
64
65
/** Get name of constraint.
66
* @return name of constraint
67
*/
68
std::string
69
NavGraphNodeConstraint::name
()
70
{
71
return
name_
;
72
}
73
74
/** Perform compuations before graph search and to indicate re-planning.
75
* The compute method is called on all constraints just before a path
76
* search is performed and to check if re-planning should be tried.
77
*
78
* It can be used for example to cache results for the coming search
79
* run. The search guarantees that for each complete search run
80
* compute() is called once and only once and that no two search runs
81
* overlap, i.e., compute() will not be called while another search is
82
* still running.
83
*
84
* Constraints must indicate whether any change has occured during
85
* computation or since the last compute() call through the return
86
* value. This is used to determine if re-planning should be
87
* attempted.
88
*
89
* @return true if a change has occured during computation or since
90
* the last call, false otherwise
91
*/
92
bool
93
NavGraphNodeConstraint::compute
(
void
)
throw
()
94
{
95
return
false
;
96
}
97
98
/** Check if constraint matches name.
99
* @param name name string to compare this constraints name to
100
* @return true if the given name is the same as this constraint's name,
101
* false otherwise
102
*/
103
bool
104
NavGraphNodeConstraint::operator==
(
const
std::string &name)
const
105
{
106
return
name_
==
name
;
107
}
108
109
}
// end of namespace fawkes
fawkes::NavGraphNodeConstraint::~NavGraphNodeConstraint
virtual ~NavGraphNodeConstraint()
Virtual empty destructor.
Definition:
node_constraint.cpp:67
fawkes::NavGraphNodeConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition:
node_constraint.cpp:99
fawkes::NavGraphNodeConstraint::name
std::string name()
Get name of constraint.
Definition:
node_constraint.cpp:75
fawkes
fawkes::NavGraphNodeConstraint::name_
std::string name_
Definition:
node_constraint.h:55
fawkes::NavGraphNodeConstraint::NavGraphNodeConstraint
NavGraphNodeConstraint(const std::string &name)
Constructor.
Definition:
node_constraint.cpp:53
fawkes::NavGraphNodeConstraint::operator==
bool operator==(const std::string &name) const
Check if constraint matches name.
Definition:
node_constraint.cpp:110
src
libs
navgraph
constraints
node_constraint.cpp
Generated by
1.8.17