Fawkes API  Fawkes Development Version
static_list_node_constraint.h
1 /***************************************************************************
2  * static_list_node_constraint.h - node constraint that holds a static list
3  * of nodes to block
4  *
5  * Created: Sun Mar 02 10:47:35 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_NODE_CONSTRAINT_H_
24 #define _NAVGRAPH_CONSTRAINTS_STATIC_LIST_NODE_CONSTRAINT_H_
25 
26 #include <navgraph/constraints/node_constraint.h>
27 #include <navgraph/navgraph.h>
28 
29 #include <string>
30 #include <vector>
31 
32 namespace fawkes {
33 
35 {
36 public:
38 
39  NavGraphStaticListNodeConstraint(std::string name, std::vector<fawkes::NavGraphNode> &node_list);
40 
42 
43  const std::vector<fawkes::NavGraphNode> &node_list() const;
44 
45  void add_node(const fawkes::NavGraphNode &node);
46  void add_nodes(const std::vector<fawkes::NavGraphNode> &nodes);
47  void remove_node(const fawkes::NavGraphNode &node);
48  void clear_nodes();
49  bool has_node(const fawkes::NavGraphNode &node);
50 
51  virtual bool compute(void) throw();
52 
53  virtual bool
54  blocks(const fawkes::NavGraphNode &node) throw()
55  {
56  return has_node(node);
57  }
58 
59 protected:
60  std::vector<fawkes::NavGraphNode> node_list_; ///< Node list
61  bool modified_; ///< Set to true if changes are made to the constraint.
62 };
63 
64 } // end namespace fawkes
65 
66 #endif
fawkes::NavGraphStaticListNodeConstraint::remove_node
void remove_node(const fawkes::NavGraphNode &node)
Remove a single node from the constraint list.
Definition: static_list_node_constraint.cpp:99
fawkes::NavGraphNode
Topological graph node.
Definition: navgraph_node.h:36
fawkes::NavGraphStaticListNodeConstraint::has_node
bool has_node(const fawkes::NavGraphNode &node)
Check if constraint has a specific node.
Definition: static_list_node_constraint.cpp:113
fawkes::NavGraphStaticListNodeConstraint::~NavGraphStaticListNodeConstraint
virtual ~NavGraphStaticListNodeConstraint()
Virtual empty destructor.
Definition: static_list_node_constraint.cpp:57
fawkes::NavGraphStaticListNodeConstraint::modified_
bool modified_
Set to true if changes are made to the constraint.
Definition: static_list_node_constraint.h:61
fawkes::NavGraphNodeConstraint
Constraint that can be queried to check if a node is blocked.
Definition: node_constraint.h:35
fawkes::NavGraphStaticListNodeConstraint::NavGraphStaticListNodeConstraint
NavGraphStaticListNodeConstraint(std::string name)
Constructor.
Definition: static_list_node_constraint.cpp:37
fawkes::NavGraphNodeConstraint::name
std::string name()
Get name of constraint.
Definition: node_constraint.cpp:69
fawkes::NavGraphStaticListNodeConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition: static_list_node_constraint.cpp:62
fawkes
Fawkes library namespace.
fawkes::NavGraphStaticListNodeConstraint::clear_nodes
void clear_nodes()
Remove all nodes.
Definition: static_list_node_constraint.cpp:129
fawkes::NavGraphStaticListNodeConstraint::add_node
void add_node(const fawkes::NavGraphNode &node)
Add a single node to constraint list.
Definition: static_list_node_constraint.cpp:76
fawkes::NavGraphStaticListNodeConstraint
Constraint that holds a list of nodes to block.
Definition: static_list_node_constraint.h:35
fawkes::NavGraphStaticListNodeConstraint::blocks
virtual bool blocks(const fawkes::NavGraphNode &node)
Check if constraint blocks a node.
Definition: static_list_node_constraint.h:54
fawkes::NavGraphStaticListNodeConstraint::add_nodes
void add_nodes(const std::vector< fawkes::NavGraphNode > &nodes)
Add multiple nodes to constraint list.
Definition: static_list_node_constraint.cpp:88
fawkes::NavGraphStaticListNodeConstraint::node_list
const std::vector< fawkes::NavGraphNode > & node_list() const
Get list of blocked nodes.
Definition: static_list_node_constraint.cpp:122
fawkes::NavGraphStaticListNodeConstraint::node_list_
std::vector< fawkes::NavGraphNode > node_list_
Node list.
Definition: static_list_node_constraint.h:60