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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // A single lane the router may use
17 /****************************************************************************/
18 #ifndef ROLane_h
19 #define ROLane_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
29 #include <utils/common/Named.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class ROEdge;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
51 class ROLane : public Named {
52 public:
60  ROLane(const std::string& id, ROEdge* edge, double length, double maxSpeed, SVCPermissions permissions, const PositionVector& shape) :
61  Named(id), myEdge(edge), myLength(length), myMaxSpeed(maxSpeed), myPermissions(permissions), myShape(shape) {
62  }
63 
64 
66  ~ROLane() { }
67 
68 
72  double getLength() const {
73  return myLength;
74  }
75 
76 
80  double getSpeed() const {
81  return myMaxSpeed;
82  }
83 
84 
88  inline SVCPermissions getPermissions() const {
89  return myPermissions;
90  }
91 
95  ROEdge& getEdge() const {
96  return *myEdge;
97  }
98 
100  const std::vector<std::pair<const ROLane*, const ROEdge*> >& getOutgoingViaLanes() const {
101  return myOutgoingLanes;
102  }
103 
104  void addOutgoingLane(ROLane* lane, ROEdge* via = nullptr) {
105  myOutgoingLanes.push_back(std::make_pair(lane, via));
106  }
107 
110  return LINKSTATE_MAJOR;
111  }
112 
113  inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {
114  return (myPermissions & vclass) == vclass;
115  }
116 
117  const PositionVector& getShape() const {
118  return myShape;
119  }
120 
121 private:
124 
126  double myLength;
127 
129  double myMaxSpeed;
130 
133 
134  std::vector<std::pair<const ROLane*, const ROEdge*> > myOutgoingLanes;
135 
138 
139 
140 private:
142  ROLane(const ROLane& src);
143 
145  ROLane& operator=(const ROLane& src);
146 
147 };
148 
149 
150 #endif
151 
152 /****************************************************************************/
153 
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
Named
Base class for objects which have an id.
Definition: Named.h:57
ROLane::addOutgoingLane
void addOutgoingLane(ROLane *lane, ROEdge *via=nullptr)
Definition: ROLane.h:104
ROLane::getLength
double getLength() const
Returns the length of the lane.
Definition: ROLane.h:72
ROLane::myOutgoingLanes
std::vector< std::pair< const ROLane *, const ROEdge * > > myOutgoingLanes
Definition: ROLane.h:134
ROLane::~ROLane
~ROLane()
Destructor.
Definition: ROLane.h:66
ROLane
A single lane the router may use.
Definition: ROLane.h:51
ROLane::getIncomingLinkState
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane (ignored for routing)
Definition: ROLane.h:109
LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Definition: SUMOXMLDefinitions.h:1150
PositionVector
A list of positions.
Definition: PositionVector.h:46
ROLane::allowsVehicleClass
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: ROLane.h:113
ROLane::getShape
const PositionVector & getShape() const
Definition: ROLane.h:117
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
ROLane::myLength
double myLength
The length of the lane.
Definition: ROLane.h:126
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
ROLane::getSpeed
double getSpeed() const
Returns the maximum speed allowed on this lane.
Definition: ROLane.h:80
ROLane::ROLane
ROLane(const std::string &id, ROEdge *edge, double length, double maxSpeed, SVCPermissions permissions, const PositionVector &shape)
Constructor.
Definition: ROLane.h:60
Named.h
SUMOVehicleClass.h
ROLane::myPermissions
SVCPermissions myPermissions
The encoding of allowed vehicle classes.
Definition: ROLane.h:132
ROLane::getEdge
ROEdge & getEdge() const
Returns the lane's edge.
Definition: ROLane.h:95
ROLane::myShape
const PositionVector myShape
shape for this lane
Definition: ROLane.h:137
ROLane::myEdge
ROEdge * myEdge
The parent edge of this lane.
Definition: ROLane.h:123
ROLane::myMaxSpeed
double myMaxSpeed
The maximum speed allowed on the lane.
Definition: ROLane.h:129
ROLane::getOutgoingViaLanes
const std::vector< std::pair< const ROLane *, const ROEdge * > > & getOutgoingViaLanes() const
get the map of outgoing lanes to via edges
Definition: ROLane.h:100
ROLane::operator=
ROLane & operator=(const ROLane &src)
Invalidated assignment operator.
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:73
config.h
ROLane::getPermissions
SVCPermissions getPermissions() const
Returns the list of allowed vehicle classes.
Definition: ROLane.h:88
PositionVector.h