Fawkes API  Fawkes Development Version
static_list_edge_cost_constraint.h
1 /***************************************************************************
2  * static_list_edge_cost_constraint.h - edge constraint that holds cost
3  * factors for edges in a static list
4  *
5  * Created: Fri Jul 18 15:37:10 2014 (Ouro Branco Hotel, Joao Pessoa, Brazil)
6  * Copyright 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 #ifndef __NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_COST_CONSTRAINT_H_
23 #define __NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_COST_CONSTRAINT_H_
24 
25 #include <navgraph/constraints/edge_cost_constraint.h>
26 #include <core/utils/lock_vector.h>
27 
28 #include <vector>
29 #include <string>
30 
31 #include <navgraph/navgraph.h>
32 
33 namespace fawkes{
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
39 {
40  public:
42 
44 
45  const std::vector<std::pair<fawkes::NavGraphEdge, float>> & edge_cost_list() const;
46 
47  void add_edge(const fawkes::NavGraphEdge &edge, const float cost_factor);
48  void add_edges(const std::vector<std::pair<fawkes::NavGraphEdge, float>> &edge_costs);
49  void remove_edge(const fawkes::NavGraphEdge &edge);
50  void clear_edges();
51  bool has_edge(const fawkes::NavGraphEdge &edge);
52 
53  virtual bool compute(void) throw();
54 
55  virtual float cost_factor(const fawkes::NavGraphNode &from,
56  const fawkes::NavGraphNode &to) throw();
57 
58  private:
59  std::vector<std::pair<fawkes::NavGraphEdge, float>> edge_cost_list_;
61  bool modified_;
62 
63 };
64 
65 } // end namespace fawkes
66 
67 #endif
void add_edge(const fawkes::NavGraphEdge &edge, const float cost_factor)
Add a single edge to constraint list.
Fawkes library namespace.
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
Constraint that hold cost factors for a static list of edges.
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Constraint that can be queried for an edge cost factor.
virtual float cost_factor(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)
Get cost factor for given edge.
virtual ~NavGraphStaticListEdgeCostConstraint()
Virtual empty destructor.
const std::vector< std::pair< fawkes::NavGraphEdge, float > > & edge_cost_list() const
Get list of blocked edges.
void add_edges(const std::vector< std::pair< fawkes::NavGraphEdge, float >> &edge_costs)
Add multiple edges to constraint list.
Vector with a lock.
Definition: lock_vector.h:37
Topological graph edge.
Definition: navgraph_edge.h:39
Topological graph node.
Definition: navgraph_node.h:38
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
std::string name()
Get name of constraint.