Fawkes API  Fawkes Development Version
timed_reservation_list_edge_constraint.h
1 /***************************************************************************
2  * timed_reservation_list_edge_constraint.h - edge constraint that holds a static
3  * list of edges and a duration to block
4  *
5  * Created: Sat Jul 12 16:48:23 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_TIMED_RESERVATION_LIST_EDGE_CONSTRAINT_H_
24 #define _NAVGRAPH_CONSTRAINTS_TIMED_RESERVATION_LIST_EDGE_CONSTRAINT_H_
25 
26 #include <logging/logger.h>
27 #include <navgraph/constraints/static_list_edge_constraint.h>
28 #include <navgraph/navgraph.h>
29 #include <utils/time/time.h>
30 
31 #include <string>
32 #include <vector>
33 
34 namespace fawkes {
35 
37 {
38 public:
40  std::string constraint_name,
41  fawkes::Clock *clock);
42 
44  Logger * logger,
45  std::string constraint_name,
46  fawkes::Clock * clock,
47  std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> edge_time_list);
48 
50 
51  const std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> &edge_time_list() const;
52 
53  void add_edge(const fawkes::NavGraphEdge &edge, const fawkes::Time valid_time);
54  void add_edges(const std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> &edges);
55  void remove_edge(const fawkes::NavGraphEdge &edge);
56  void clear_edges();
57  bool has_edge(const fawkes::NavGraphEdge &edge);
58 
59  virtual bool compute(void) throw();
60  virtual bool blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) throw();
61 
62 private:
63  std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> edge_time_list_;
64  bool modified_;
65  Logger * logger_;
66  fawkes::Clock * clock_;
67  std::string constraint_name_;
68 };
69 
70 } // end namespace fawkes
71 
72 #endif
fawkes::NavGraphNode
Topological graph node.
Definition: navgraph_node.h:36
fawkes::NavGraphTimedReservationListEdgeConstraint::edge_time_list
const std::vector< std::pair< fawkes::NavGraphEdge, fawkes::Time > > & edge_time_list() const
Get list of blocked edges.
Definition: timed_reservation_list_edge_constraint.cpp:200
fawkes::NavGraphTimedReservationListEdgeConstraint::blocks
virtual bool blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)
Check if constraint blocks an edge.
Definition: timed_reservation_list_edge_constraint.cpp:184
fawkes::NavGraphTimedReservationListEdgeConstraint
Constraint that holds a list of edges to block with timeouts.
Definition: timed_reservation_list_edge_constraint.h:37
fawkes::NavGraphTimedReservationListEdgeConstraint::clear_edges
void clear_edges()
Remove all edges.
Definition: timed_reservation_list_edge_constraint.cpp:207
fawkes::NavGraphEdge
Topological graph edge.
Definition: navgraph_edge.h:38
fawkes::NavGraphTimedReservationListEdgeConstraint::add_edge
void add_edge(const fawkes::NavGraphEdge &edge, const fawkes::Time valid_time)
Add a single edge to constraint list.
Definition: timed_reservation_list_edge_constraint.cpp:109
fawkes::NavGraphTimedReservationListEdgeConstraint::add_edges
void add_edges(const std::vector< std::pair< fawkes::NavGraphEdge, fawkes::Time >> &edges)
Add multiple edges to constraint list.
Definition: timed_reservation_list_edge_constraint.cpp:134
fawkes::NavGraphTimedReservationListEdgeConstraint::remove_edge
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
Definition: timed_reservation_list_edge_constraint.cpp:153
fawkes::NavGraphEdgeConstraint
Constraint that can be queried to check if an edge is blocked.
Definition: edge_constraint.h:35
fawkes::Logger
Interface for logging.
Definition: logger.h:42
fawkes::NavGraphTimedReservationListEdgeConstraint::~NavGraphTimedReservationListEdgeConstraint
virtual ~NavGraphTimedReservationListEdgeConstraint()
Virtual empty destructor.
Definition: timed_reservation_list_edge_constraint.cpp:71
fawkes
Fawkes library namespace.
fawkes::Time
A class for handling time.
Definition: time.h:93
fawkes::NavGraphTimedReservationListEdgeConstraint::NavGraphTimedReservationListEdgeConstraint
NavGraphTimedReservationListEdgeConstraint(Logger *logger, std::string constraint_name, fawkes::Clock *clock)
Constructor.
Definition: timed_reservation_list_edge_constraint.cpp:41
fawkes::NavGraphTimedReservationListEdgeConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition: timed_reservation_list_edge_constraint.cpp:76
fawkes::NavGraphTimedReservationListEdgeConstraint::has_edge
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
Definition: timed_reservation_list_edge_constraint.cpp:173
fawkes::Clock
This is supposed to be the central clock in Fawkes.
Definition: clock.h:35