SUMO - Simulation of Urban MObility

MSLink Class Reference

#include <MSLink.h>

Data Structures

struct  ApproachingVehicleInformation
class  vehicle_in_request_finder

Public Member Functions

void addBlockedLink (MSLink *link) throw ()
bool blockedAtTime (SUMOTime arrivalTime, SUMOTime leaveTime) const throw ()
LinkDirection getDirection () const throw ()
 Returns the direction the vehicle passing this link take.
MSLane * getLane () const throw ()
 Returns the connected lane.
SUMOReal getLength () const throw ()
 Returns the length of this link.
unsigned int getRespondIndex () const throw ()
 Returns the respond index (for visualization)
LinkState getState () const throw ()
 Returns the current state of the link.
bool hasApproachingFoe (SUMOTime arrivalTime, SUMOTime leaveTime) const throw ()
 Returns the information whether a vehicle is approaching on one of the link's foe streams.
bool havePriority () const throw ()
 Returns whether this link is a major link.
bool isBlockingAnyone () const throw ()
bool isCont () const throw ()
bool isCrossing () const throw ()
 Returns whether this link belongs to a junction where more than one edge is incoming.
 MSLink (MSLane *succLane, LinkDirection dir, LinkState state, SUMOReal length) throw ()
 Constructor for simulation not using internal lanes.
bool opened (SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal vehicleLength) const throw ()
 Returns the information whether the link may be passed.
void removeApproaching (SUMOVehicle *veh)
void setApproaching (SUMOVehicle *approaching, SUMOTime arrivalTime, SUMOReal speed, bool setRequest) throw ()
 Sets the information about an approaching vehicle.
void setRequestInformation (unsigned int requestIdx, unsigned int respondIdx, bool isCrossing, bool isCont, const std::vector< MSLink * > &foeLinks, const std::vector< MSLane * > &foeLanes) throw ()
 Sets the request information.
void setTLState (LinkState state, SUMOTime t) throw ()
 Sets the current tl-state.
bool willHaveBlockedFoe () const throw ()
 ~MSLink () throw ()
 Destructor.

Private Types

typedef std::vector
< ApproachingVehicleInformation > 
LinkApproachingVehicles

Private Member Functions

 MSLink (const MSLink &s)
 invalidated copy constructor
MSLink & operator= (const MSLink &s)
 invalidated assignment operator

Private Attributes

bool myAmCont
LinkApproachingVehicles myApproachingVehicles
std::set< MSLink * > myBlockedFoeLinks
LinkDirection myDirection
 An abstract (hopefully human readable) definition of the link's direction.
std::vector< MSLane * > myFoeLanes
std::vector< MSLink * > myFoeLinks
bool myIsCrossing
 Whether any foe links exist.
MSLane * myLane
 The lane approached by this link.
SUMOReal myLength
 The length of the link.
unsigned int myRequestIdx
 The position of the link within this request.
unsigned int myRespondIdx
 The position within this respond.
LinkState myState
 The state of the link.

Static Private Attributes

static SUMOTime myLookaheadTime = TIME2STEPS(3)

Detailed Description

Definition at line 68 of file MSLink.h.


Member Typedef Documentation

Definition at line 239 of file MSLink.h.


Constructor & Destructor Documentation

MSLink::MSLink ( MSLane *  succLane,
LinkDirection  dir,
LinkState  state,
SUMOReal  length 
) throw ()

Constructor for simulation not using internal lanes.

Parameters:
[in]succLaneThe lane approached by this link
[in]dirThe direction of this link
[in]stateThe state of this link
[in]lengthThe length of this link

Definition at line 49 of file MSLink.cpp.

MSLink::~MSLink ( ) throw ()

Destructor.

Definition at line 67 of file MSLink.cpp.

MSLink::MSLink ( const MSLink &  s) [private]

invalidated copy constructor


Member Function Documentation

void MSLink::addBlockedLink ( MSLink *  link) throw ()

Definition at line 96 of file MSLink.cpp.

bool MSLink::blockedAtTime ( SUMOTime  arrivalTime,
SUMOTime  leaveTime 
) const throw ()

Definition at line 158 of file MSLink.cpp.

LinkDirection MSLink::getDirection ( ) const throw ()

Returns the direction the vehicle passing this link take.

Returns:
The direction of this link

Definition at line 188 of file MSLink.cpp.

References myDirection.

MSLane * MSLink::getLane ( ) const throw ()

Returns the connected lane.

Returns:
The lane approached by this link

Definition at line 200 of file MSLink.cpp.

References myLane.

Referenced by MSVehicle::checkRewindLinkLanes(), Command_SaveTLSSwitches::execute(), MSLinkContHelper::getConnectingLink(), MSVehicle::moveChecked(), TraCIServerAPI_TLS::processGet(), and TraCIServerAPI_Lane::processGet().

SUMOReal MSLink::getLength ( ) const throw () [inline]

Returns the length of this link.

Returns:
The length of this link

Definition at line 204 of file MSLink.h.

References myLength.

Referenced by TraCIServerAPI_Lane::processGet().

unsigned int MSLink::getRespondIndex ( ) const throw ()

Returns the respond index (for visualization)

Returns:
The respond index for this link

Definition at line 214 of file MSLink.cpp.

References myRespondIdx.

LinkState MSLink::getState ( ) const throw () [inline]

Returns the current state of the link.

Returns:
The current state of this link

Definition at line 159 of file MSLink.h.

References myState.

Referenced by Command_SaveTLCoupledLaneDet::execute(), MSVehicle::moveChecked(), and GUILaneWrapper::ROWdrawAction_drawLinkRules().

bool MSLink::hasApproachingFoe ( SUMOTime  arrivalTime,
SUMOTime  leaveTime 
) const throw ()

Returns the information whether a vehicle is approaching on one of the link's foe streams.

Valid after the vehicles have set their requests

Returns:
Whether a foe of this link is approaching

Definition at line 172 of file MSLink.cpp.

Referenced by TraCIServerAPI_Lane::processGet().

bool MSLink::havePriority ( ) const throw () [inline]

Returns whether this link is a major link.

Returns:
Whether the link has a large priority

Definition at line 195 of file MSLink.h.

References myState.

Referenced by MSVehicle::moveChecked(), and TraCIServerAPI_Lane::processGet().

bool MSLink::isBlockingAnyone ( ) const throw () [inline]

Definition at line 138 of file MSLink.h.

References myApproachingVehicles.

bool MSLink::isCont ( ) const throw () [inline]

Definition at line 217 of file MSLink.h.

References myAmCont.

Referenced by MSVehicle::checkRewindLinkLanes(), and MSVehicle::moveChecked().

bool MSLink::isCrossing ( ) const throw () [inline]

Returns whether this link belongs to a junction where more than one edge is incoming.

Returns:
Whether any foe links exist

Definition at line 212 of file MSLink.h.

References myIsCrossing.

Referenced by MSVehicle::checkRewindLinkLanes().

bool MSLink::opened ( SUMOTime  arrivalTime,
SUMOReal  arrivalSpeed,
SUMOReal  vehicleLength 
) const throw ()

Returns the information whether the link may be passed.

Valid after the junctions have set their reponds

Returns:
Whether this link may be passed.

Definition at line 123 of file MSLink.cpp.

References LINKSTATE_TL_RED, SUMOReal, and TIME2STEPS.

Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::moveChecked(), and TraCIServerAPI_Lane::processGet().

MSLink& MSLink::operator= ( const MSLink &  s) [private]

invalidated assignment operator

void MSLink::removeApproaching ( SUMOVehicle *  veh)

Definition at line 114 of file MSLink.cpp.

References myApproachingVehicles.

Referenced by MSVehicle::moveChecked().

void MSLink::setApproaching ( SUMOVehicle *  approaching,
SUMOTime  arrivalTime,
SUMOReal  speed,
bool  setRequest 
) throw ()

Sets the information about an approaching vehicle.

The information is stored in myApproachingVehicles.

Parameters:
[in]approachingThe approaching vehicle

Definition at line 84 of file MSLink.cpp.

References TIME2STEPS.

void MSLink::setRequestInformation ( unsigned int  requestIdx,
unsigned int  respondIdx,
bool  isCrossing,
bool  isCont,
const std::vector< MSLink * > &  foeLinks,
const std::vector< MSLane * > &  foeLanes 
) throw ()

Sets the request information.

Because traffic lights and junction logics are loaded after links, we have to assign the information about the right-of-way requests and responses after the initialisation.

Parameters:
[in]requestIdxThis link's index within this request
[in]respondIdxThis link's index within this respond
[in]foesThis link's foes
Todo:
Unsecure!

Definition at line 71 of file MSLink.cpp.

void MSLink::setTLState ( LinkState  state,
SUMOTime  t 
) throw ()

Sets the current tl-state.

Parameters:
[in]stateThe current state of the link

Definition at line 194 of file MSLink.cpp.

References myState.

Referenced by MSTrafficLightLogic::addLink().

bool MSLink::willHaveBlockedFoe ( ) const throw ()

Definition at line 103 of file MSLink.cpp.

References myBlockedFoeLinks.

Referenced by MSVehicle::checkRewindLinkLanes().


Field Documentation

Definition at line 280 of file MSLink.h.

Referenced by isCont().

std::set<MSLink*> MSLink::myBlockedFoeLinks [private]

Definition at line 260 of file MSLink.h.

Referenced by willHaveBlockedFoe().

An abstract (hopefully human readable) definition of the link's direction.

Definition at line 272 of file MSLink.h.

Referenced by getDirection().

std::vector<MSLane*> MSLink::myFoeLanes [private]

Definition at line 288 of file MSLink.h.

std::vector<MSLink*> MSLink::myFoeLinks [private]

Definition at line 287 of file MSLink.h.

Whether any foe links exist.

Definition at line 278 of file MSLink.h.

Referenced by isCrossing().

MSLane* MSLink::myLane [private]

The lane approached by this link.

Definition at line 257 of file MSLink.h.

Referenced by getLane().

SUMOReal MSLink::myLength [private]

The length of the link.

Definition at line 275 of file MSLink.h.

Referenced by getLength().

SUMOTime MSLink::myLookaheadTime = TIME2STEPS(3) [static, private]

Definition at line 289 of file MSLink.h.

unsigned int MSLink::myRequestIdx [private]

The position of the link within this request.

Definition at line 263 of file MSLink.h.

unsigned int MSLink::myRespondIdx [private]

The position within this respond.

Definition at line 266 of file MSLink.h.

Referenced by getRespondIndex().

The state of the link.

Definition at line 269 of file MSLink.h.

Referenced by getState(), havePriority(), and setTLState().


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