Fawkes API  Fawkes Development Version
static_list_edge_constraint.h
1 /***************************************************************************
2  * static_list_edge_constraint.h - edge constraint that holds a static list
3  * of edges to block
4  *
5  * Created: Sat Jul 12 16:46:50 2014
6  * Copyright 2014 Sebastian Reuter
7  * 2014 Tim Niemueller
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_CONSTRAINT_H_
24 #define _NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_CONSTRAINT_H_
25 
26 #include <navgraph/constraints/edge_constraint.h>
27 #include <navgraph/navgraph.h>
28 
29 #include <string>
30 #include <vector>
31 
32 namespace fawkes {
33 
34 class NavGraphStaticListEdgeConstraint : public NavGraphEdgeConstraint
35 {
36 public:
38 
39  NavGraphStaticListEdgeConstraint(std::string name, std::vector<fawkes::NavGraphEdge> &edge_list);
40 
42 
43  const std::vector<fawkes::NavGraphEdge> &edge_list() const;
44 
45  void add_edge(const fawkes::NavGraphEdge &edge);
46  void add_edges(const std::vector<fawkes::NavGraphEdge> &edges);
47  void remove_edge(const fawkes::NavGraphEdge &edge);
48  void clear_edges();
49  bool has_edge(const fawkes::NavGraphEdge &edge);
50 
51  virtual bool compute(void) throw();
52 
53  virtual bool blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) throw();
54 
55 private:
56  std::vector<fawkes::NavGraphEdge> edge_list_;
57  bool modified_;
58 };
59 
60 } // end namespace fawkes
61 
62 #endif
fawkes::NavGraphNode
Definition: navgraph_node.h:40
fawkes::NavGraphStaticListEdgeConstraint::add_edge
void add_edge(const fawkes::NavGraphEdge &edge)
Add a single edge to constraint list.
Definition: static_list_edge_constraint.cpp:84
fawkes::NavGraphStaticListEdgeConstraint::blocks
virtual bool blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)
Definition: static_list_edge_constraint.cpp:146
fawkes::NavGraphEdge
Definition: navgraph_edge.h:42
fawkes::NavGraphStaticListEdgeConstraint::clear_edges
void clear_edges()
Remove all edges.
Definition: static_list_edge_constraint.cpp:137
fawkes
fawkes::NavGraphStaticListEdgeConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition: static_list_edge_constraint.cpp:70
fawkes::NavGraphStaticListEdgeConstraint::add_edges
void add_edges(const std::vector< fawkes::NavGraphEdge > &edges)
Add multiple edges to constraint list.
Definition: static_list_edge_constraint.cpp:96
fawkes::NavGraphStaticListEdgeConstraint::remove_edge
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
Definition: static_list_edge_constraint.cpp:107
fawkes::NavGraphStaticListEdgeConstraint::has_edge
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
Definition: static_list_edge_constraint.cpp:121
fawkes::NavGraphStaticListEdgeConstraint::~NavGraphStaticListEdgeConstraint
virtual ~NavGraphStaticListEdgeConstraint()
Virtual empty destructor.
Definition: static_list_edge_constraint.cpp:65
fawkes::NavGraphStaticListEdgeConstraint::NavGraphStaticListEdgeConstraint
NavGraphStaticListEdgeConstraint(std::string name)
Constructor.
Definition: static_list_edge_constraint.cpp:45
fawkes::NavGraphEdgeConstraint::name
std::string name()
Get name of constraint.
Definition: edge_constraint.cpp:83
fawkes::NavGraphStaticListEdgeConstraint::edge_list
const std::vector< fawkes::NavGraphEdge > & edge_list() const
Get list of blocked edges.
Definition: static_list_edge_constraint.cpp:130