Fawkes API
Fawkes Development Version
edge_constraint.cpp
1
/***************************************************************************
2
* edge_constraint.cpp - base class for edge constraints
3
*
4
* Created: Sat Jul 12 14:48:02 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/edge_constraint.h>
23
24
namespace
fawkes
{
25
26
/** @class NavGraphEdgeConstraint <navgraph/constraints/edge_constraint.h>
27
* Constraint that can be queried to check if an edge is blocked.
28
* @author Sebastian Reuter
29
* @author Tim Niemueller
30
*
31
* @fn bool NavGraphEdgeConstraint::blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) throw() = 0
32
* Check if constraint blocks an edge.
33
* This method must be implemented by constraint classes. It is called
34
* to determine if an edge should be considered blocked and therefore
35
* cannot be expanded during path search.
36
*
37
* Note that the nodes may be passed in either ordering, therefore
38
* you should not rely on a particular order, not even for directed
39
* nodes!
40
*
41
* Further note that the method may not throw an exception. Handle
42
* this internally appropriately.
43
*
44
* @param from node from which the edge originates
45
* @param to node to which the edge leads
46
* @return true if the edge should be considered blocked, false otherwise
47
*
48
* @var std::string NavGraphEdgeConstraint::name_
49
* Name of constraint.
50
*/
51
52
/** Constructor.
53
* @param name name of edge constraint
54
*/
55
NavGraphEdgeConstraint::NavGraphEdgeConstraint
(
const
std::string &name)
56
{
57
name_
=
name
;
58
}
59
60
/** Constructor.
61
* @param name name of edge constraint
62
*/
63
NavGraphEdgeConstraint::NavGraphEdgeConstraint
(
const
char
*name)
64
{
65
name_
=
name
;
66
}
67
68
/** Virtual empty destructor. */
69
NavGraphEdgeConstraint::~NavGraphEdgeConstraint
()
70
{
71
}
72
73
/** Get name of constraint.
74
* @return name of constraint
75
*/
76
std::string
77
NavGraphEdgeConstraint::name
()
78
{
79
return
name_
;
80
}
81
82
/** Perform compuations before graph search and to indicate re-planning.
83
* The compute method is called on all constraints just before a path
84
* search is performed and to check if re-planning should be tried.
85
*
86
* It can be used for example to cache results for the coming search
87
* run. The search guarantees that for each complete search run
88
* compute() is called once and only once and that no two search runs
89
* overlap, i.e., compute() will not be called while another search is
90
* still running.
91
*
92
* Constraints must indicate whether any change has occured during
93
* computation or since the last compute() call through the return
94
* value. This is used to determine if re-planning should be
95
* attempted.
96
*
97
* @return true if a change has occured during computation or since
98
* the last call, false otherwise
99
*/
100
bool
101
NavGraphEdgeConstraint::compute
(
void
)
throw
()
102
{
103
return
false
;
104
}
105
106
/** Check if constraint matches name.
107
* @param name name string to compare this constraints name to
108
* @return true if the given name is the same as this constraint's name,
109
* false otherwise
110
*/
111
bool
112
NavGraphEdgeConstraint::operator==
(
const
std::string &name)
const
113
{
114
return
name_
==
name
;
115
}
116
117
}
// end of namespace fawkes
fawkes::NavGraphEdgeConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition:
edge_constraint.cpp:107
fawkes::NavGraphEdgeConstraint::operator==
bool operator==(const std::string &name) const
Check if constraint matches name.
Definition:
edge_constraint.cpp:118
fawkes::NavGraphEdgeConstraint::name_
std::string name_
Definition:
edge_constraint.h:55
fawkes
fawkes::NavGraphEdgeConstraint::NavGraphEdgeConstraint
NavGraphEdgeConstraint(const std::string &name)
Constructor.
Definition:
edge_constraint.cpp:61
fawkes::NavGraphEdgeConstraint::~NavGraphEdgeConstraint
virtual ~NavGraphEdgeConstraint()
Virtual empty destructor.
Definition:
edge_constraint.cpp:75
fawkes::NavGraphEdgeConstraint::name
std::string name()
Get name of constraint.
Definition:
edge_constraint.cpp:83
src
libs
navgraph
constraints
edge_constraint.cpp
Generated by
1.8.17