43 typedef std::pair<const SUMOVehicle* const, const MSLink::ApproachingVehicleInformation>
Approaching;
44 typedef std::set<const MSLane*, ComparatorNumericalIdLess>
LaneSet;
45 typedef std::map<const MSLane*, int, ComparatorNumericalIdLess>
LaneVisitedMap;
63 MSDriveWay(
const MSLink* origin,
const std::string&
id,
bool temporary =
false);
114 const std::vector<const MSEdge*>&
getRoute()
const {
118 const std::vector<const MSLane*>&
getFlank()
const {
122 const std::vector<const MSLane*>&
getBidi()
const {
138 void setEvents(
const std::vector<VehicleEvent>& events) {
146 const std::vector<MSDriveWay*>&
getFoes()
const {
157 void addDWDeadlock(
const std::vector<const MSDriveWay*>& deadlockFoes);
275 void checkFlanks(
const MSLink* originLink,
const std::vector<const MSLane*>& lanes,
const LaneVisitedMap& visited,
bool allFoes, std::set<MSLink*>& flankSwitches)
const;
360 std::set<SUMOVehicle*, ComparatorNumericalIdLess>
myTrains;
std::vector< MSEdge * > MSEdgeVector
ConstMSEdgeVector::const_iterator MSRouteIterator
void addFoes(const MSLink *link)
add all driveWays that start at the given link as foes
std::vector< MSLink * > myConflictLinks
const SUMOVehicle * myActive
whether the current signal is switched green for a train approaching this block
bool crossingConflict(const MSDriveWay &other) const
Wether there is a crossing conflict with the given driveway.
static std::string getJunctionLinkID(const MSLink *link)
return junctionID_junctionLinkIndex
bool haveSubTrains() const
std::vector< MSDriveWay * > mySubDriveWays
std::vector< std::set< const MSDriveWay * > > myDeadlocks
void checkFlanks(const MSLink *originLink, const std::vector< const MSLane * > &lanes, const LaneVisitedMap &visited, bool allFoes, std::set< MSLink * > &flankSwitches) const
bool myAbortedBuild
whether driveway building was aborted due to MAX_BLOCK_LENGTH
bool buildSubFoe(MSDriveWay *foe, bool movingBlock)
std::set< SUMOVehicle *, ComparatorNumericalIdLess > myTrains
static std::map< const MSJunction *, int > myDepartDrivewayIndex
static bool hasJoin(const SUMOVehicle *ego, const SUMOVehicle *foe)
bool isDepartDriveway() const
static std::string getClickableTLLinkID(const MSLink *link)
return logicID_linkIndex in a way that allows clicking in sumo-gui
const MSLink * myOrigin
the link that enters this driveway or nullptr for a departure driveWay
static double myMovingBlockMaxDist
std::vector< const MSLane * > myBidi
static bool myWriteVehicles
void checkCrossingFlanks(MSLink *dwLink, const LaneVisitedMap &visited, std::set< MSLink * > &flankSwitches) const
bool notifyReroute(SUMOTrafficObject &veh)
Called if the vehicle change it's route.
bool hasLinkConflict(const Approaching &closest, const MSLink *foeLink) const
Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link...
void findFlankProtection(MSLink *link, MSLink *origLink, std::vector< const MSLane * > &flank)
std::vector< const MSLane * > myBidiExtended
static bool hasRS(const MSEdge *cur, const MSEdge *next)
void addBidiFoes(const MSRailSignal *ownSignal, bool extended)
derive foe driveways based on myBidi or myBidiExtended
static const MSDriveWay * retrieveDepartDriveWay(const MSEdge *edge, const std::string &id)
static bool haveDriveWays()
void writeBlocks(OutputDevice &od) const
Write block items for this driveway.
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder's lane.
std::vector< const MSLane * > myForward
const std::vector< const MSLane * > & getBidi() const
std::vector< const MSEdge * > myReversals
track own occurences in myReversalDriveWays for cleanup in destructor
std::map< const MSDriveWay *, std::vector< Siding >, ComparatorIdLess > mySidings
const std::vector< MSDriveWay * > & getSubDriveWays() const
void writeBlockVehicles(OutputDevice &od) const
virtual ~MSDriveWay()
Destructor.
bool match(MSRouteIterator firstIt, MSRouteIterator endIt) const
whether the give route matches this driveway
static void appendMapIndex(LaneVisitedMap &map, const MSLane *lane)
append to map by map index and avoid undefined behavior
bool overlap(const MSDriveWay &other) const
Wether this driveway (route) overlaps with the given one.
void setEvents(const std::vector< VehicleEvent > &events)
void buildRoute(const MSLink *origin, MSRouteIterator next, MSRouteIterator end, LaneVisitedMap &visited, std::set< MSLink * > &)
std::vector< const MSLane * > myFlank
static std::string getTLLinkID(const MSLink *link)
return logicID_linkIndex
const std::vector< const MSLane * > & getForward() const
std::vector< const MSEdge * > myRoute
list of edges for matching against train routes
std::map< const MSLane *, int, ComparatorNumericalIdLess > LaneVisitedMap
static void writeDepatureBlocks(OutputDevice &od, bool writeVehicles)
static std::map< ConstMSEdgeVector, MSDriveWay * > myDriveWayRouteLookup
lookup table for state loading
int getNumericalID() const
static std::set< const MSEdge * > myBlockLengthWarnings
static std::map< const MSEdge *, std::vector< MSDriveWay * > > myReversalDriveWays
all driveways reversing on the given switch (used to look up flank foes)
void _saveState(OutputDevice &out) const
static std::string formatVisitedMap(const LaneVisitedMap &visited)
print link descriptions
static std::map< std::string, MSDriveWay * > myDriveWayLookup
int matchesPastRoute(SUMOVehicle &sveh) const
const std::vector< MSLink * > & getConflictLinks() const
const std::vector< MSDriveWay * > & getFoes() const
const MSLink * getOrigin() const
bool flankConflict(const MSDriveWay &other) const
Wether there is a flank conflict with the given driveway.
bool conflictLaneOccupied(bool store=true, const SUMOVehicle *ego=nullptr) const
whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored)
void addSwitchFoes(MSLink *link)
bool hasTrain(SUMOVehicle *veh) const
whether the given train is on this driveway
static std::map< const MSEdge *, std::vector< MSDriveWay * > > myDepartureDrivewaysEnds
all driveways that do not start at a rail signal (and are only used at departure) by end edge
int myCoreSize
number of edges in myRoute where overlap with other driveways is forbidden
double getForwardDistance(int lastIndex) const
compute distance along the forward section up to lastIndex
std::pair< const SUMOVehicle *const, const MSLink::ApproachingVehicleInformation > Approaching
void addConflictLink(const MSLink *link)
add symmetical conflict link for foes when building a new driveway
bool notifyLeaveBack(SUMOTrafficObject &veh, Notification reason, const MSLane *leftLane)
Called if the vehicle's back leaves the reminder's lane.
std::string myFirstVehicle
the first vehicle using this driveway
int myNumericalID
global driveway index
bool forwardEndOnRoute(const MSDriveWay *foe) const
static void saveState(OutputDevice &out)
Save driveway occupancy into the given stream.
static std::map< const MSEdge *, std::vector< MSDriveWay * >, ComparatorNumericalIdLess > myDepartureDriveways
all driveways that do not start at a rail signal (and are only used at departure)
void setVehicle(const std::string &vehID)
bool myBidiEnded
whether driveway building was aborted when no further bidi edge was found
static bool mustYield(const Approaching &veh, const Approaching &foe)
Whether veh must yield to the foe train.
const std::vector< const MSEdge * > & getRoute() const
void addSidings(MSDriveWay *foe, bool addToFoe=false)
add sidings for the given foe
void enterDriveWay(SUMOVehicle &sveh, Notification reason)
helper method for notifyEnter
bool bidiBlockedByEnd(const MSDriveWay &other) const
Wether there is a bidi conflict with the end of the given driveway.
static int myGlobalDriveWayIndex
static MSDriveWay * buildDriveWay(const std::string &id, const MSLink *link, MSRouteIterator first, MSRouteIterator end)
construct a new driveway by searching along the given route until all block structures are found
bool myFoundSignal
whether this driveway ends its forward section with a rail signal (and thus comprises a full block)
static std::map< const MSLink *, std::vector< MSDriveWay * > > mySwitchDriveWays
all driveways passing the given switch (used to look up flank foes)
bool isFoeOrSubFoe(const MSDriveWay *foe) const
const std::vector< const MSLane * > & getFlank() const
const std::vector< VehicleEvent > & getEvents() const
void addReversalFoes(bool movingBlock)
derive foe driveways that enter the bidi section by reversing
int myForwardEdgeCount
number of normal edges in myForward
void addDWDeadlock(const std::vector< const MSDriveWay * > &deadlockFoes)
static std::map< const MSEdge *, std::vector< MSDriveWay * >, ComparatorNumericalIdLess > myEndingDriveways
all driveways that end on the given edge
bool foeDriveWayApproached() const
whether any of my Foes is being approached
static void loadState(const SUMOSAXAttributes &attrs, int tag)
bool forwardRouteConflict(std::set< const MSEdge * > forward, const MSDriveWay &other, bool secondCheck=false)
Wether the route of other passes into the forward section of this driveway.
std::pair< bool, const MSDriveWay * > canUseSiding(const SUMOVehicle *ego, const MSDriveWay *foe, bool recurse=true) const
return whether a siding can be used. If a siding exist but is occupied, also return the occupied driv...
std::vector< const MSLane * > myConflictLanes
the lanes that must be clear of trains before this signal can switch to green
static const MSDriveWay * getDepartureDriveway(const SUMOVehicle *veh, bool init=false)
std::vector< MSDriveWay * > myFoes
std::vector< VehicleEvent > myVehicleEvents
std::set< const MSLane *, ComparatorNumericalIdLess > LaneSet
static bool isSwitch(const MSLink *link)
bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
bool bidiBlockedBy(const MSDriveWay &other) const
Wether there is a bidi conflict with the given driveway.
bool reserve(const Approaching &closest, MSEdgeVector &occupied)
attempt reserve this driveway for the given vehicle
void addParallelFoes(const MSLink *link, const MSEdge *first)
derive foe driveways that start at the same signal
bool foeDriveWayOccupied(bool store, const SUMOVehicle *ego, MSEdgeVector &occupied) const
whether any of myFoes is occupied (vehicles that are the target of a join must be ignored)
A road/street connecting two junctions.
Representation of a lane in the micro simulation.
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
Base class for objects which have an id.
Static storage of an output device and its base (abstract) implementation.
Encapsulated SAX-Attributes.
Representation of a vehicle, person, or container.
Representation of a vehicle.
Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle)
Function-object for stable sorting of objects with numerical ids.
Siding(int s, int e, double l)
VehicleEvent(SUMOTime _time, bool _isEntry, const std::string &_id, Notification _reason)