SUMO - Simulation of Urban MObility
|
#include <NBRequest.h>
Public Member Functions | |
void | buildBitfieldLogic (bool leftHanded) |
bool | foes (const NBEdge *const from1, const NBEdge *const to1, const NBEdge *const from2, const NBEdge *const to2) const |
Returns the information whether the given flows cross. More... | |
bool | forbids (const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo, bool regardNonSignalisedLowerPriority) const |
Returns the information whether "prohibited" flow must let "prohibitor" flow pass. More... | |
std::pair< unsigned int, unsigned int > | getSizes () const |
returns the number of the junction's lanes and the number of the junction's links in respect. More... | |
bool | mustBrake (const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo) const |
Returns the information whether "prohibited" flow must let "prohibitor" flow pass. More... | |
bool | mustBrake (const NBEdge *const from, const NBEdge *const to) const |
Returns the information whether the described flow must let any other flow pass. More... | |
bool | mustBrakeForCrossing (const NBEdge *const from, const NBEdge *const to, const NBNode::Crossing &crossing) const |
Returns the information whether the described flow must brake for the given crossing. More... | |
NBRequest (const NBEdgeCont &ec, NBNode *junction, const EdgeVector &all, const EdgeVector &incoming, const EdgeVector &outgoing, const NBConnectionProhibits &loadedProhibits) | |
void | writeLogic (std::string key, OutputDevice &into, const bool checkLaneFoes) const |
~NBRequest () | |
Static Public Member Functions | |
static void | reportWarnings () |
reports warnings if any occured More... | |
Private Types | |
typedef std::vector< LinkInfoCont > | CombinationsCont |
typedef std::vector< bool > | LinkInfoCont |
typedef std::map< NBEdge *, LaneVector > | OccupiedLanes |
Private Member Functions | |
void | computeLeftOutgoingLinkCrossings (bool leftHanded, NBEdge *from, NBEdge *to) |
void | computeRightOutgoingLinkCrossings (bool leftHanded, NBEdge *from, NBEdge *to) |
size_t | distanceCounterClockwise (NBEdge *from, NBEdge *to) |
std::string | getFoesString (NBEdge *from, NBEdge *to, int fromLane, int toLane, const bool checkLaneFoes) const |
int | getIndex (const NBEdge *const from, const NBEdge *const to) const |
Returns the index to the internal combination container for the given edge combination. More... | |
std::string | getResponseString (const NBEdge *const from, const NBEdge *const to, int fromLane, int toLane, bool mayDefinitelyPass, const bool checkLaneFoes) const |
Writes the response of a certain link. More... | |
bool | laneConflict (const NBEdge *from, const NBEdge *to, int toLane, const NBEdge *prohibitorFrom, const NBEdge *prohibitorTo, int prohibitorToLane) const |
return whether the given laneToLane connections prohibit each other under the assumption that the edge2edge connections are in conflict More... | |
size_t | numLinks () const |
return to total number of edge-to-edge connections of this request-logic More... | |
NBRequest & | operator= (const NBRequest &s) |
Invalidated assignment operator. More... | |
void | resetCooperating () |
reset foes it the number of lanes matches (or exceeds) the number of incoming connections for an edge More... | |
void | resetSignalised () |
bool | rightTurnConflict (const NBEdge *from, const NBEdge *to, int fromLane, const NBEdge *prohibitorFrom, const NBEdge *prohibitorTo, int prohibitorFromLane) const |
return whether the given laneToLane connection is a right turn which must yield to pedestrian or bicycle crossings More... | |
void | setBlocking (bool leftHanded, NBEdge *from1, NBEdge *to1, NBEdge *from2, NBEdge *to2) |
int | writeCrossingResponse (OutputDevice &od, const NBNode::Crossing &crossing, int pos) const |
writes the response of a certain crossing Returns the next link index within the junction More... | |
int | writeLaneResponse (OutputDevice &od, NBEdge *from, int lane, int pos, const bool checkLaneFoes) const |
writes the response of a certain lane Returns the next link index within the junction More... | |
Private Attributes | |
const EdgeVector & | myAll |
const std::vector< NBNode::Crossing > & | myCrossings |
CombinationsCont | myDone |
CombinationsCont | myForbids |
const EdgeVector & | myIncoming |
NBNode * | myJunction |
the node the request is assigned to More... | |
const EdgeVector & | myOutgoing |
Static Private Attributes | |
static size_t | myGoodBuilds = 0 |
static size_t | myNotBuild = 0 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NBRequest &r) |
prints the request More... | |
Given a special node, this class builds the logic of this (junction) regarding the relationships between the incoming and outgoing edges and their priorities. The junction's logic is saved when it does not yet exist.
Definition at line 66 of file NBRequest.h.
|
private |
definition of a container for link(edge->edge) X link(edge->edge) combinations (size = |myIncoming|*|myOutgoing|)
Definition at line 256 of file NBRequest.h.
|
private |
definition of a container to store boolean informations about a link into
Definition at line 252 of file NBRequest.h.
|
private |
a container for approached lanes of a certain edge
Definition at line 259 of file NBRequest.h.
NBRequest::NBRequest | ( | const NBEdgeCont & | ec, |
NBNode * | junction, | ||
const EdgeVector & | all, | ||
const EdgeVector & | incoming, | ||
const EdgeVector & | outgoing, | ||
const NBConnectionProhibits & | loadedProhibits | ||
) |
constructor The parameter are the logic's lists of edges (all, incoming only and outgoing only edges). By now no further informations are needed to describe the junctions. These parameter must not be changed during the logic's building
Definition at line 68 of file NBRequest.cpp.
References NBConnection::check(), NBConnection::getFrom(), Named::getID(), getIndex(), NBConnection::getTo(), myDone, myForbids, myGoodBuilds, myIncoming, myNotBuild, myOutgoing, numLinks(), and WRITE_WARNING.
NBRequest::~NBRequest | ( | ) |
destructor
Definition at line 154 of file NBRequest.cpp.
void NBRequest::buildBitfieldLogic | ( | bool | leftHanded | ) |
builds the bitset-representation of the logic
Definition at line 158 of file NBRequest.cpp.
References computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), myIncoming, myOutgoing, resetCooperating(), and resetSignalised().
Referenced by NBNode::computeLogic().
|
private |
computes the relationships between links outgoing left of the given link
Definition at line 192 of file NBRequest.cpp.
References myAll, myJunction, NBContHelper::nextCW(), and setBlocking().
Referenced by buildBitfieldLogic().
|
private |
computes the relationships between links outgoing right of the given link
Definition at line 174 of file NBRequest.cpp.
References myAll, myJunction, NBContHelper::nextCCW(), and setBlocking().
Referenced by buildBitfieldLogic().
returns the distance between the incoming (from) and the outgoing (to) edge clockwise in edges
Definition at line 321 of file NBRequest.cpp.
References myAll.
bool NBRequest::foes | ( | const NBEdge *const | from1, |
const NBEdge *const | to1, | ||
const NBEdge *const | from2, | ||
const NBEdge *const | to2 | ||
) | const |
Returns the information whether the given flows cross.
[in] | from1 | The starting edge of the first stream |
[in] | to1 | The ending edge of the first stream |
[in] | from2 | The starting edge of the second stream |
[in] | to2 | The ending edge of the second stream |
Definition at line 433 of file NBRequest.cpp.
References getIndex(), myForbids, myIncoming, and myOutgoing.
Referenced by NBNode::foes(), getFoesString(), resetSignalised(), and writeCrossingResponse().
bool NBRequest::forbids | ( | const NBEdge *const | possProhibitorFrom, |
const NBEdge *const | possProhibitorTo, | ||
const NBEdge *const | possProhibitedFrom, | ||
const NBEdge *const | possProhibitedTo, | ||
bool | regardNonSignalisedLowerPriority | ||
) | const |
Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
[in] | possProhibitorFrom | The maybe prohibiting connection's begin |
[in] | possProhibitorTo | The maybe prohibiting connection's end |
[in] | possProhibitedFrom | The maybe prohibited connection's begin |
[in] | possProhibitedTo | The maybe prohibited connection's end |
[in] | regardNonSignalisedLowerPriority | Whether the right of way rules without traffic lights shall be regarded |
Definition at line 452 of file NBRequest.cpp.
References getIndex(), NBEdge::hasSignalisedConnectionTo(), myForbids, myIncoming, and myOutgoing.
Referenced by NBNode::forbids().
|
private |
writes which participating links are foes to the given
Definition at line 585 of file NBRequest.cpp.
References foes(), laneConflict(), myCrossings, myIncoming, and rightTurnConflict().
Referenced by writeLaneResponse().
Returns the index to the internal combination container for the given edge combination.
If one of the edges is not known, -1 is returned.
[in] | from | The starting edge (incoming to this logic) |
[in] | to | The destination edge (outgoing from this logic) |
Definition at line 670 of file NBRequest.cpp.
References myIncoming, and myOutgoing.
Referenced by foes(), forbids(), getResponseString(), mustBrake(), NBRequest(), resetCooperating(), resetSignalised(), and setBlocking().
|
private |
Writes the response of a certain link.
For the link (described by the connected edges and lanes), the response in dependence to all other links of this junction is computed. Herefor, the method goes through all links of this junction and writes a '0' if the link is not blocked by the currently investigated one, or '1' if it is.
In the case "mayDefinitelyPass" is true, the link will not be disturbed by any other (special case for on-ramps).
[in] | od | The stream to write the information to |
[in] | from | The link's starting edge |
[in] | to | The link's destination edge |
[in] | fromLane | The link's starting lane |
[in] | toLane | The link's destination lane |
[in] | mayDefinitelyPass | Whether this link is definitely not disturbed |
IOError | not yet implemented |
Definition at line 539 of file NBRequest.cpp.
References getIndex(), laneConflict(), mustBrakeForCrossing(), myCrossings, myForbids, myIncoming, myOutgoing, and rightTurnConflict().
Referenced by writeLaneResponse().
returns the number of the junction's lanes and the number of the junction's links in respect.
Definition at line 414 of file NBRequest.cpp.
References myIncoming.
Referenced by NBNode::numNormalConnections().
|
private |
return whether the given laneToLane connections prohibit each other under the assumption that the edge2edge connections are in conflict
Definition at line 625 of file NBRequest.cpp.
References NBEdge::getAngleAtNode(), NBEdge::getFromNode(), NBEdge::getToNode(), NBEdge::isTurningDirectionAt(), NBHelpers::relAngle(), and SUMOReal.
Referenced by getFoesString(), and getResponseString().
bool NBRequest::mustBrake | ( | const NBEdge *const | possProhibitorFrom, |
const NBEdge *const | possProhibitorTo, | ||
const NBEdge *const | possProhibitedFrom, | ||
const NBEdge *const | possProhibitedTo | ||
) | const |
Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
[in] | possProhibitorFrom | The maybe prohibiting connection's begin |
[in] | possProhibitorTo | The maybe prohibiting connection's end |
[in] | possProhibitedFrom | The maybe prohibited connection's begin |
[in] | possProhibitedTo | The maybe prohibited connection's end |
Definition at line 746 of file NBRequest.cpp.
References getIndex(), and myForbids.
Referenced by NBNode::mustBrake().
Returns the information whether the described flow must let any other flow pass.
[in] | from | The connection's start edge |
[in] | to | The connection's end edge |
Definition at line 701 of file NBRequest.cpp.
References getIndex(), mustBrakeForCrossing(), myCrossings, myDone, myForbids, myIncoming, myOutgoing, and numLinks().
bool NBRequest::mustBrakeForCrossing | ( | const NBEdge *const | from, |
const NBEdge *const | to, | ||
const NBNode::Crossing & | crossing | ||
) | const |
Returns the information whether the described flow must brake for the given crossing.
[in] | from | The connection's start edge |
[in] | to | The connection's end edge |
[in] | crossing | The pedestrian crossing to check |
Definition at line 730 of file NBRequest.cpp.
References NBNode::Crossing::edges, NBNode::getDirection(), LINKDIR_LEFT, LINKDIR_RIGHT, myJunction, and NBNode::Crossing::priority.
Referenced by getResponseString(), mustBrake(), NBNode::mustBrakeForCrossing(), and writeCrossingResponse().
|
inlineprivate |
return to total number of edge-to-edge connections of this request-logic
Definition at line 797 of file NBRequest.cpp.
References myCrossings, myIncoming, and myOutgoing.
Referenced by mustBrake(), NBRequest(), and operator<<().
|
static |
reports warnings if any occured
Definition at line 756 of file NBRequest.cpp.
References myGoodBuilds, myNotBuild, toString(), and WRITE_WARNING.
Referenced by NBNetBuilder::compute().
|
private |
reset foes it the number of lanes matches (or exceeds) the number of incoming connections for an edge
Definition at line 765 of file NBRequest.cpp.
References getIndex(), myForbids, and myIncoming.
Referenced by buildBitfieldLogic().
|
private |
Definition at line 354 of file NBRequest.cpp.
References foes(), getIndex(), myForbids, and myIncoming.
Referenced by buildBitfieldLogic().
|
private |
return whether the given laneToLane connection is a right turn which must yield to pedestrian or bicycle crossings
Definition at line 647 of file NBRequest.cpp.
References OptionsCont::getBool(), GeomHelper::getCWAngleDiff(), NBEdge::getEndAngle(), OptionsCont::getOptions(), NBEdge::getStartAngle(), NBEdge::getToNode(), NBEdge::isTurningDirectionAt(), and SUMOReal.
Referenced by getFoesString(), and getResponseString().
|
private |
sets the information that the edge from1->to1 blocks the edge from2->to2 (is higher priorised than this)
Definition at line 210 of file NBRequest.cpp.
References getIndex(), NBEdge::getJunctionPriority(), NBNode::getType(), NBEdge::isTurningDirectionAt(), myAll, myDone, myForbids, myIncoming, myJunction, myOutgoing, NBContHelper::nextCW(), NODETYPE_ALLWAY_STOP, and NODETYPE_RIGHT_BEFORE_LEFT.
Referenced by computeLeftOutgoingLinkCrossings(), and computeRightOutgoingLinkCrossings().
|
private |
writes the response of a certain crossing Returns the next link index within the junction
Definition at line 503 of file NBRequest.cpp.
References OutputDevice::closeTag(), NBNode::Crossing::edges, foes(), NBEdge::getConnectionsFromLane(), NBEdge::getNumLanes(), mustBrakeForCrossing(), myCrossings, myIncoming, OutputDevice::openTag(), SUMO_ATTR_CONT, SUMO_ATTR_FOES, SUMO_ATTR_INDEX, SUMO_ATTR_RESPONSE, SUMO_TAG_REQUEST, and OutputDevice::writeAttr().
Referenced by writeLogic().
|
private |
writes the response of a certain lane Returns the next link index within the junction
Definition at line 484 of file NBRequest.cpp.
References OutputDevice::closeTag(), NBEdge::getConnectionsFromLane(), getFoesString(), OptionsCont::getOptions(), getResponseString(), OutputDevice::openTag(), SUMO_ATTR_CONT, SUMO_ATTR_FOES, SUMO_ATTR_INDEX, SUMO_ATTR_RESPONSE, SUMO_TAG_REQUEST, and OutputDevice::writeAttr().
Referenced by writeLogic().
void NBRequest::writeLogic | ( | std::string | key, |
OutputDevice & | into, | ||
const bool | checkLaneFoes | ||
) | const |
writes the XML-representation of the logic as a bitset-logic XML representation
Definition at line 336 of file NBRequest.cpp.
References myCrossings, myIncoming, writeCrossingResponse(), and writeLaneResponse().
Referenced by NBNode::writeLogic().
|
friend |
prints the request
Definition at line 682 of file NBRequest.cpp.
|
private |
all (icoming and outgoing) of the junctions edges
Definition at line 239 of file NBRequest.h.
Referenced by computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), distanceCounterClockwise(), and setBlocking().
|
private |
edges outgoing from the junction
Definition at line 248 of file NBRequest.h.
Referenced by getFoesString(), getResponseString(), mustBrake(), numLinks(), writeCrossingResponse(), and writeLogic().
|
private |
the link X link is done-checks
Definition at line 265 of file NBRequest.h.
Referenced by mustBrake(), NBRequest(), and setBlocking().
|
private |
the link X link blockings
Definition at line 262 of file NBRequest.h.
Referenced by foes(), forbids(), getResponseString(), mustBrake(), NBRequest(), operator<<(), resetCooperating(), resetSignalised(), and setBlocking().
|
staticprivate |
Definition at line 268 of file NBRequest.h.
Referenced by NBRequest(), and reportWarnings().
|
private |
edges incoming to the junction
Definition at line 242 of file NBRequest.h.
Referenced by buildBitfieldLogic(), foes(), forbids(), getFoesString(), getIndex(), getResponseString(), getSizes(), mustBrake(), NBRequest(), numLinks(), resetCooperating(), resetSignalised(), setBlocking(), writeCrossingResponse(), and writeLogic().
|
private |
the node the request is assigned to
Definition at line 236 of file NBRequest.h.
Referenced by computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), mustBrakeForCrossing(), and setBlocking().
|
staticprivate |
Definition at line 268 of file NBRequest.h.
Referenced by NBRequest(), and reportWarnings().
|
private |
edges outgoing from the junction
Definition at line 245 of file NBRequest.h.
Referenced by buildBitfieldLogic(), foes(), forbids(), getIndex(), getResponseString(), mustBrake(), NBRequest(), numLinks(), and setBlocking().