SUMO - Simulation of Urban MObility

MSLaneChanger Class Reference

Performs lane changing of vehicles. More...

#include <MSLaneChanger.h>

Data Structures

struct  ChangeElem

Public Types

typedef std::vector< ChangeElem > Changer
 The list of changers; For each lane, a ChangeElem is being build.
typedef Changer::iterator ChangerIt
 the iterator moving over the ChangeElems
typedef Changer::const_iterator ConstChangerIt
 the iterator moving over the ChangeElems

Public Member Functions

void laneChange (SUMOTime t)
 Start lane-change-process for all vehicles on the edge'e lanes.
 MSLaneChanger (std::vector< MSLane * > *lanes, bool allowSwap)
 Constructor.
 ~MSLaneChanger ()
 Destructor.

Protected Member Functions

bool change ()
int change2left (const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &rLead, const std::pair< MSVehicle *const, SUMOReal > &rFollow, const std::vector< MSVehicle::LaneQ > &preb) const throw ()
int change2right (const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &rLead, const std::pair< MSVehicle *const, SUMOReal > &rFollow, const std::vector< MSVehicle::LaneQ > &preb) const throw ()
ChangerIt findCandidate ()
 Find current candidate. If there is none, myChanger.end() is returned.
std::pair< MSVehicle *const,
SUMOReal > 
getRealFollower (const ChangerIt &target) const throw ()
std::pair< MSVehicle *const,
SUMOReal > 
getRealLeader (const ChangerIt &target) const throw ()
std::pair< MSVehicle *const,
SUMOReal > 
getRealThisLeader (const ChangerIt &target) const throw ()
void initChanger ()
 Initialize the changer before looping over all vehicles.
bool overlapWithHopped (ChangerIt target) const throw ()
void updateChanger (bool vehHasChanged)
void updateLanes (SUMOTime t)
MSVehicle * veh (ConstChangerIt ce) const throw ()
bool vehInChanger () const throw ()
 Check if there is a single change-candidate in the changer. Returns true if there is one.

Protected Attributes

bool myAllowsSwap
 Whether blocking vehicles may be swapped.
ChangerIt myCandi
Changer myChanger
 Container for ChangeElemements, one for every lane in the edge.

Private Member Functions

 MSLaneChanger ()
 Default constructor.
 MSLaneChanger (const MSLaneChanger &)
 Copy constructor.
MSLaneChanger & operator= (const MSLaneChanger &)
 Assignment operator.

Detailed Description

Performs lane changing of vehicles.

Definition at line 51 of file MSLaneChanger.h.


Member Typedef Documentation

typedef std::vector< ChangeElem > MSLaneChanger::Changer

The list of changers; For each lane, a ChangeElem is being build.

Definition at line 88 of file MSLaneChanger.h.

typedef Changer::iterator MSLaneChanger::ChangerIt

the iterator moving over the ChangeElems

Definition at line 91 of file MSLaneChanger.h.

typedef Changer::const_iterator MSLaneChanger::ConstChangerIt

the iterator moving over the ChangeElems

Definition at line 94 of file MSLaneChanger.h.


Constructor & Destructor Documentation

MSLaneChanger::~MSLaneChanger ( )

Destructor.

Definition at line 75 of file MSLaneChanger.cpp.

MSLaneChanger::MSLaneChanger ( ) [private]

Default constructor.

MSLaneChanger::MSLaneChanger ( const MSLaneChanger &  ) [private]

Copy constructor.


Member Function Documentation

int MSLaneChanger::change2left ( const std::pair< MSVehicle *const, SUMOReal > &  leader,
const std::pair< MSVehicle *const, SUMOReal > &  rLead,
const std::pair< MSVehicle *const, SUMOReal > &  rFollow,
const std::vector< MSVehicle::LaneQ > &  preb 
) const throw () [protected]

Definition at line 504 of file MSLaneChanger.cpp.

References LCA_BLOCKED_BY_LEFT_FOLLOWER, and LCA_BLOCKED_BY_LEFT_LEADER.

Referenced by change().

int MSLaneChanger::change2right ( const std::pair< MSVehicle *const, SUMOReal > &  leader,
const std::pair< MSVehicle *const, SUMOReal > &  rLead,
const std::pair< MSVehicle *const, SUMOReal > &  rFollow,
const std::vector< MSVehicle::LaneQ > &  preb 
) const throw () [protected]

Definition at line 464 of file MSLaneChanger.cpp.

References LCA_BLOCKED_BY_RIGHT_FOLLOWER, and LCA_BLOCKED_BY_RIGHT_LEADER.

Referenced by change().

MSLaneChanger::ChangerIt MSLaneChanger::findCandidate ( ) [protected]

Find current candidate. If there is none, myChanger.end() is returned.

Definition at line 438 of file MSLaneChanger.cpp.

References max, myChanger, and veh().

Referenced by change().

std::pair< MSVehicle *const, SUMOReal > MSLaneChanger::getRealFollower ( const ChangerIt &  target) const throw () [protected]
std::pair< MSVehicle *const, SUMOReal > MSLaneChanger::getRealLeader ( const ChangerIt &  target) const throw () [protected]
void MSLaneChanger::initChanger ( ) [protected]

Initialize the changer before looping over all vehicles.

Definition at line 95 of file MSLaneChanger.cpp.

References myChanger.

Referenced by laneChange().

void MSLaneChanger::laneChange ( SUMOTime  t)

Start lane-change-process for all vehicles on the edge'e lanes.

Definition at line 79 of file MSLaneChanger.cpp.

References change(), initChanger(), updateChanger(), updateLanes(), and vehInChanger().

MSLaneChanger& MSLaneChanger::operator= ( const MSLaneChanger &  ) [private]

Assignment operator.

bool MSLaneChanger::overlapWithHopped ( ChangerIt  target) const throw () [inline, protected]

Returns true if candidate overlaps with a vehicle, that already changed the lane.

Definition at line 156 of file MSLaneChanger.h.

References myCandi, MSVehicle::overlap(), and veh().

void MSLaneChanger::updateChanger ( bool  vehHasChanged) [protected]

After the possible change, update the changer.

Definition at line 395 of file MSLaneChanger.cpp.

References myCandi, and veh().

Referenced by laneChange().

void MSLaneChanger::updateLanes ( SUMOTime  t) [protected]

During lane-change a temporary vehicle container is filled within the lanes (bad pratice to modify foreign members, I know). Swap this container with the real one.

Definition at line 421 of file MSLaneChanger.cpp.

References myChanger.

Referenced by laneChange().

MSVehicle* MSLaneChanger::veh ( ConstChangerIt  ce) const throw () [inline, protected]

Returns a pointer to the changer-element-iterator vehicle, or 0 if there is none.

Definition at line 115 of file MSLaneChanger.h.

Referenced by change(), findCandidate(), overlapWithHopped(), updateChanger(), and vehInChanger().

bool MSLaneChanger::vehInChanger ( ) const throw () [inline, protected]

Check if there is a single change-candidate in the changer. Returns true if there is one.

Definition at line 102 of file MSLaneChanger.h.

References myChanger, and veh().

Referenced by laneChange().


Field Documentation

Whether blocking vehicles may be swapped.

Definition at line 181 of file MSLaneChanger.h.

Referenced by change().

Change-candidate. Last of the vehicles in changer. Only this one will try to change. Every vehicle on the edge will be a candidate once in the change-process.

Definition at line 178 of file MSLaneChanger.h.

Referenced by change(), overlapWithHopped(), and updateChanger().

Container for ChangeElemements, one for every lane in the edge.

Definition at line 173 of file MSLaneChanger.h.

Referenced by change(), findCandidate(), initChanger(), MSLaneChanger(), updateLanes(), and vehInChanger().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines