Drake
branch_point.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <memory>
5 #include <vector>
6 
11 
12 namespace drake {
13 namespace maliput {
14 namespace multilane {
15 
16 class BranchPoint;
17 class Lane;
18 
19 
21 class LaneEndSet : public api::LaneEndSet {
22  public:
24 
25  LaneEndSet() = default;
26  ~LaneEndSet() override = default;
27 
29  void add(const api::LaneEnd& end) { ends_.push_back(end); }
30 
31  private:
32  int do_size() const override { return ends_.size(); }
33 
34  const api::LaneEnd& do_get(int index) const override { return ends_[index]; }
35 
36  std::vector<api::LaneEnd> ends_;
37 };
38 
39 
41 class BranchPoint : public api::BranchPoint {
42  public:
44 
45 
46  BranchPoint(const api::BranchPointId& id, api::RoadGeometry* road_geometry);
49 
51  const api::LaneEnd& AddABranch(const api::LaneEnd& lane_end);
52 
54  const api::LaneEnd& AddBBranch(const api::LaneEnd& lane_end);
55 
59  void SetDefault(const api::LaneEnd& lane_end,
60  const api::LaneEnd& default_branch);
61 
62  ~BranchPoint() override = default;
63 
64  private:
65  const api::BranchPointId do_id() const override { return id_; }
66 
67  const api::RoadGeometry* do_road_geometry() const override;
68 
69  const api::LaneEndSet* DoGetConfluentBranches(
70  const api::LaneEnd& end) const override;
71 
72  const api::LaneEndSet* DoGetOngoingBranches(
73  const api::LaneEnd& end) const override;
74 
75  std::unique_ptr<api::LaneEnd> DoGetDefaultBranch(
76  const api::LaneEnd& end) const override;
77 
78  const api::LaneEndSet* DoGetASide() const override { return &a_side_; }
79 
80  const api::LaneEndSet* DoGetBSide() const override { return &b_side_; }
81 
83  api::RoadGeometry* road_geometry_{};
84  LaneEndSet a_side_;
85  LaneEndSet b_side_;
86 
87  std::map<api::LaneEnd, LaneEndSet*,
88  api::LaneEnd::StrictOrder> confluent_branches_;
89  std::map<api::LaneEnd, LaneEndSet*,
90  api::LaneEnd::StrictOrder> ongoing_branches_;
91  std::map<api::LaneEnd, api::LaneEnd,
92  api::LaneEnd::StrictOrder> defaults_;
93 };
94 
95 } // namespace multilane
96 } // namespace maliput
97 } // namespace drake
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:66
A specific endpoint of a specific Lane.
Definition: lane_data.h:22
Definition: automotive_demo.cc:88
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
TypeSpecificIdentifier< class BranchPoint > BranchPointId
Definition: branch_point.h:18
An implementation of api::BranchPoint.
Definition: branch_point.h:41
A set of LaneEnds.
Definition: branch_point.h:22
Definition: arc_road_curve.cc:11
An arbitrary strict complete ordering, useful for, e.g., std::map.
Definition: lane_data.h:28
An implementation of LaneEndSet.
Definition: branch_point.h:21
void add(const api::LaneEnd &end)
Adds a LaneEnd.
Definition: branch_point.h:29
#define DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Classname)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN deletes the special member functions for copy-construction, copy-assignment, move-construction, and move-assignment.
Definition: drake_copyable.h:35
Provides careful macros to selectively enable or disable the special member functions for copy-constr...