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 <navgraph/constraints/static_list_edge_constraint.h>
27 
28 #include <vector>
29 #include <string>
30 
31 #include <utils/time/time.h>
32 #include <navgraph/navgraph.h>
33 #include <logging/logger.h>
34 
35 namespace fawkes{
36 
37 
39 {
40  public:
41  NavGraphTimedReservationListEdgeConstraint(Logger *logger, std::string constraint_name, fawkes::Clock *clock);
42 
43  NavGraphTimedReservationListEdgeConstraint(Logger *logger, std::string constraint_name, fawkes::Clock *clock,
44  std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> edge_time_list );
45 
47 
48  const std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> & edge_time_list() const;
49 
50  void add_edge(const fawkes::NavGraphEdge &edge, const fawkes::Time valid_time);
51  void add_edges(const std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> &edges);
52  void remove_edge(const fawkes::NavGraphEdge &edge);
53  void clear_edges();
54  bool has_edge(const fawkes::NavGraphEdge &edge);
55 
56  virtual bool compute(void) throw();
57  virtual bool blocks(const fawkes::NavGraphNode &from,
58  const fawkes::NavGraphNode &to) throw();
59 
60  private:
61  std::vector<std::pair<fawkes::NavGraphEdge, fawkes::Time>> edge_time_list_;
62  bool modified_;
63  Logger *logger_;
64  fawkes::Clock *clock_;
65  std::string constraint_name_;
66 
67 };
68 
69 } // end namespace fawkes
70 
71 #endif
72 
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Constraint that can be queried to check if an edge is blocked.
NavGraphTimedReservationListEdgeConstraint(Logger *logger, std::string constraint_name, fawkes::Clock *clock)
Constructor.
Fawkes library namespace.
This is supposed to be the central clock in Fawkes.
Definition: clock.h:34
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
A class for handling time.
Definition: time.h:91
virtual bool blocks(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)
Check if constraint blocks an edge.
const std::vector< std::pair< fawkes::NavGraphEdge, fawkes::Time > > & edge_time_list() const
Get list of blocked edges.
Constraint that holds a list of edges to block with timeouts.
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
Topological graph edge.
Definition: navgraph_edge.h:39
Topological graph node.
Definition: navgraph_node.h:38
void add_edges(const std::vector< std::pair< fawkes::NavGraphEdge, fawkes::Time >> &edges)
Add multiple edges to constraint list.
void add_edge(const fawkes::NavGraphEdge &edge, const fawkes::Time valid_time)
Add a single edge to constraint list.
Interface for logging.
Definition: logger.h:34