Drake
junction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
11 
12 namespace drake {
13 namespace maliput {
14 namespace monolane {
15 
16 /// An api::Junction implementation.
17 class Junction : public api::Junction {
18  public:
20 
21  /// Constructs an empty Junction.
22  ///
23  /// @p road_geometry must remain valid for the lifetime of this class,
24  /// and must refer to the RoadGeometry which will contain the newly
25  /// constructed Junction instance.
27  : id_(id), road_geometry_(road_geometry) {}
28 
29  /// Creates and adds a new Segment with the specified @p id.
31 
32  ~Junction() override = default;
33 
34  private:
35  const api::JunctionId do_id() const override { return id_; }
36 
37  const api::RoadGeometry* do_road_geometry() const override;
38 
39  int do_num_segments() const override { return segments_.size(); }
40 
41  const api::Segment* do_segment(int index) const override {
42  return segments_[index].get();
43  }
44 
45  api::JunctionId id_;
46  api::RoadGeometry* road_geometry_{};
47  std::vector<std::unique_ptr<Segment>> segments_;
48 };
49 
50 } // namespace monolane
51 } // namespace maliput
52 } // namespace drake
A simple api::RoadGeometry implementation that only supports a single lane per segment.
Definition: road_geometry.h:20
Definition: automotive_demo.cc:88
const RoadGeometry * road_geometry() const
Returns the RoadGeometry to which this Junction belongs.
Definition: junction.h:37
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
Segment * NewSegment(api::SegmentId id)
Creates and adds a new Segment with the specified id.
Definition: junction.cc:12
TypeSpecificIdentifier< class Junction > JunctionId
Persistent identifier for a Junction element.
Definition: junction.h:17
An api::Segment implementation.
Definition: segment.h:19
A Segment represents a bundle of adjacent Lanes which share a continuously traversable road surface...
Definition: segment.h:27
A Junction is a closed set of Segments which have physically coplanar road surfaces, in the sense that RoadPositions with the same h value (height above surface) in the domains of two Segments map to the same GeoPosition.
Definition: junction.h:27
An api::Junction implementation.
Definition: junction.h:17
TypeSpecificIdentifier< class Segment > SegmentId
Persistent identifier for a Segment element.
Definition: segment.h:17
#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...