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 rndf {
15 
16 class BranchPoint;
17 class Lane;
18 
20 class LaneEndSet : public api::LaneEndSet {
21  public:
23 
24  LaneEndSet() = default;
25  ~LaneEndSet() override = default;
26 
28  void add(const api::LaneEnd& end) { ends_.push_back(end); }
29 
30  private:
31  int do_size() const override { return ends_.size(); }
32 
33  const api::LaneEnd& do_get(int index) const override { return ends_[index]; }
34 
35  std::vector<api::LaneEnd> ends_;
36 };
37 
39 class BranchPoint : public api::BranchPoint {
40  public:
42 
43 
44  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*, api::LaneEnd::StrictOrder>
88  confluent_branches_;
89  std::map<api::LaneEnd, LaneEndSet*, api::LaneEnd::StrictOrder>
90  ongoing_branches_;
91  std::map<api::LaneEnd, api::LaneEnd, api::LaneEnd::StrictOrder> defaults_;
92 };
93 
94 } // namespace rndf
95 } // namespace maliput
96 } // 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
~LaneEndSet() override=default
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
A set of LaneEnds.
Definition: branch_point.h:22
void add(const api::LaneEnd &end)
Adds a LaneEnd.
Definition: branch_point.h:28
An implementation of api::BranchPoint for RNDF.
Definition: branch_point.h:39
An implementation of LaneEndSet for RNDF.
Definition: branch_point.h:20
#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...