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 
12 
13 namespace drake {
14 namespace maliput {
15 namespace dragway {
16 
17 class BranchPoint;
18 class Lane;
19 
20 /// Dragway's implementation of api::LaneEndSet. Since a dragway::Lane connects
21 /// to itself, this LaneEndSet only contains one api::LaneEnd.
22 class LaneEndSet final : public api::LaneEndSet {
23  public:
25 
26  explicit LaneEndSet(const api::Lane* lane, api::LaneEnd::Which which_end)
27  : end_(lane, which_end) {}
28 
29  ~LaneEndSet() override = default;
30 
31  private:
32  int do_size() const override { return 1; }
33 
34  const api::LaneEnd& do_get(int) const override { return end_; }
35 
36  const api::LaneEnd end_;
37 };
38 
39 
40 /// Dragway's implementation of api::BranchPoint.
41 class BranchPoint final : public api::BranchPoint {
42  public:
44 
45  /// Constructs a fully initialized BranchPoint for a Dragway lane.
46  ///
47  /// @param[in] id The ID of this branch point. It can be any user-specified
48  /// value.
49  ///
50  /// @param[in] lane A pointer to the lane to which this branch point belongs.
51  /// This pointer must remain valid for the lifetime of this class's instance.
52  ///
53  /// @param[in] road_geometry A pointer to the %RoadGeometry to which this
54  /// BranchPoint belongs. This pointer must remain valid for the lifetime of
55  /// this class's instance.
56  ///
57  BranchPoint(const api::BranchPointId& id, const Lane* lane,
58  const api::RoadGeometry* road_geometry);
59 
60  ~BranchPoint() final = default;
61 
62  private:
63  const api::BranchPointId do_id() const override { return id_; }
64 
65  const api::RoadGeometry* do_road_geometry() const override;
66 
67  const api::LaneEndSet* DoGetConfluentBranches(
68  const api::LaneEnd& end) const override;
69 
70  const api::LaneEndSet* DoGetOngoingBranches(
71  const api::LaneEnd& end) const override;
72 
73  optional<api::LaneEnd> DoGetDefaultBranch(
74  const api::LaneEnd& end) const override;
75 
76  const api::LaneEndSet* DoGetASide() const override;
77 
78  const api::LaneEndSet* DoGetBSide() const override;
79 
80  const api::BranchPointId id_;
82  const LaneEndSet start_side_lane_end_set_;
83  const LaneEndSet finish_side_lane_end_set_;
84 };
85 
86 } // namespace dragway
87 } // namespace maliput
88 } // namespace drake
std::unique_ptr< RoadGeometry > road_geometry_
Definition: dragway_test.cc:336
Dragway&#39;s implementation of api::LaneEndSet.
Definition: branch_point.h:22
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:67
A specific endpoint of a specific Lane.
Definition: lane_data.h:21
Definition: automotive_demo.cc:88
Dragway&#39;s implementation of api::Lane.
Definition: lane.h:75
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:19
A set of LaneEnds.
Definition: branch_point.h:23
stx::optional< T > optional
Definition: drake_optional.h:14
Provides drake::optional as an alias for the appropriate implementation of std::optional or std::expe...
Dragway&#39;s implementation of api::BranchPoint.
Definition: branch_point.h:41
#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:33
Provides careful macros to selectively enable or disable the special member functions for copy-constr...