Eclipse SUMO - Simulation of Urban MObility
ROLane.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A single lane the router may use
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <vector>
26 #include <utils/common/Named.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class ROEdge;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
48 class ROLane : public Named {
49 public:
57  ROLane(const std::string& id, ROEdge* edge, double length, double maxSpeed, SVCPermissions permissions, const PositionVector& shape) :
58  Named(id), myEdge(edge), myLength(length), myMaxSpeed(maxSpeed), myPermissions(permissions), myShape(shape) {
59  }
60 
61 
63  ~ROLane() { }
64 
65 
69  double getLength() const {
70  return myLength;
71  }
72 
73 
77  double getSpeed() const {
78  return myMaxSpeed;
79  }
80 
81 
85  inline SVCPermissions getPermissions() const {
86  return myPermissions;
87  }
88 
92  ROEdge& getEdge() const {
93  return *myEdge;
94  }
95 
97  const std::vector<std::pair<const ROLane*, const ROEdge*> >& getOutgoingViaLanes() const {
98  return myOutgoingLanes;
99  }
100 
101  void addOutgoingLane(ROLane* lane, ROEdge* via = nullptr) {
102  myOutgoingLanes.push_back(std::make_pair(lane, via));
103  }
104 
107  return LINKSTATE_MAJOR;
108  }
109 
110  inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {
111  return (myPermissions & vclass) == vclass;
112  }
113 
114  const PositionVector& getShape() const {
115  return myShape;
116  }
117 
118 private:
121 
123  double myLength;
124 
126  double myMaxSpeed;
127 
130 
131  std::vector<std::pair<const ROLane*, const ROEdge*> > myOutgoingLanes;
132 
135 
136 
137 private:
139  ROLane(const ROLane& src);
140 
142  ROLane& operator=(const ROLane& src);
143 
144 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Base class for objects which have an id.
Definition: Named.h:53
A list of positions.
A basic edge for routing applications.
Definition: ROEdge.h:70
A single lane the router may use.
Definition: ROLane.h:48
double myLength
The length of the lane.
Definition: ROLane.h:123
ROLane(const std::string &id, ROEdge *edge, double length, double maxSpeed, SVCPermissions permissions, const PositionVector &shape)
Constructor.
Definition: ROLane.h:57
ROEdge * myEdge
The parent edge of this lane.
Definition: ROLane.h:120
~ROLane()
Destructor.
Definition: ROLane.h:63
ROLane & operator=(const ROLane &src)
Invalidated assignment operator.
ROEdge & getEdge() const
Returns the lane's edge.
Definition: ROLane.h:92
double myMaxSpeed
The maximum speed allowed on the lane.
Definition: ROLane.h:126
const PositionVector & getShape() const
Definition: ROLane.h:114
double getLength() const
Returns the length of the lane.
Definition: ROLane.h:69
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: ROLane.h:110
SVCPermissions getPermissions() const
Returns the list of allowed vehicle classes.
Definition: ROLane.h:85
const PositionVector myShape
shape for this lane
Definition: ROLane.h:134
const std::vector< std::pair< const ROLane *, const ROEdge * > > & getOutgoingViaLanes() const
get the map of outgoing lanes to via edges
Definition: ROLane.h:97
std::vector< std::pair< const ROLane *, const ROEdge * > > myOutgoingLanes
Definition: ROLane.h:131
void addOutgoingLane(ROLane *lane, ROEdge *via=nullptr)
Definition: ROLane.h:101
ROLane(const ROLane &src)
Invalidated copy constructor.
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane (ignored for routing)
Definition: ROLane.h:106
double getSpeed() const
Returns the maximum speed allowed on this lane.
Definition: ROLane.h:77
SVCPermissions myPermissions
The encoding of allowed vehicle classes.
Definition: ROLane.h:129