SUMO - Simulation of Urban MObility

NBRequest Class Reference

#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 throw ()
 Returns the information whether the given flows cross.
bool forbids (const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo, bool regardNonSignalisedLowerPriority) const throw ()
 Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
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.
bool mustBrake (const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo) const throw ()
 Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
bool mustBrake (const NBEdge *const from, const NBEdge *const to) const throw ()
 Returns the information whether the described flow must let any other flow pass.
 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
 ~NBRequest ()

Static Public Member Functions

static void reportWarnings ()
 reports warnings if any occured

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)
int getIndex (const NBEdge *const from, const NBEdge *const to) const throw ()
 Returns the index to the internal combination container for the given edge combination.
void resetSignalised ()
void setBlocking (bool leftHanded, NBEdge *from1, NBEdge *to1, NBEdge *from2, NBEdge *to2)
void writeAreFoes (OutputDevice &od, NBEdge *from, NBEdge *to, bool isInnerEnd) const
int writeLaneResponse (OutputDevice &od, NBEdge *from, int lane, int pos) const
 writes the response of a certain lane Returns the next link index within the junction
void writeResponse (OutputDevice &od, const NBEdge *const from, const NBEdge *const to, int fromLane, int toLane, bool mayDefinitelyPass) const throw (IOError)
 Writes the response of a certain link.

Private Attributes

const EdgeVector & myAll
CombinationsCont myDone
CombinationsCont myForbids
const EdgeVector & myIncoming
NBNode * myJunction
 the node the request is assigned to
static size_t myNotBuild = 0
const EdgeVector & myOutgoing

Static Private Attributes

static size_t myGoodBuilds = 0

Friends

std::ostream & operator<< (std::ostream &os, const NBRequest &r)
 prints the request

Detailed Description

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 62 of file NBRequest.h.


Member Typedef Documentation

typedef std::vector<LinkInfoCont> NBRequest::CombinationsCont [private]

definition of a container for link(edge->edge) X link(edge->edge) combinations (size = |myIncoming|*|myOutgoing|)

Definition at line 220 of file NBRequest.h.

typedef std::vector<bool> NBRequest::LinkInfoCont [private]

definition of a container to store boolean informations about a link into

Definition at line 216 of file NBRequest.h.

typedef std::map<NBEdge*, LaneVector> NBRequest::OccupiedLanes [private]

a container for approached lanes of a certain edge

Definition at line 223 of file NBRequest.h.


Constructor & Destructor Documentation

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 64 of file NBRequest.cpp.

References NBConnection::check(), NBConnection::getFrom(), Named::getID(), getIndex(), NBConnection::getTo(), myDone, myForbids, myGoodBuilds, myIncoming, myNotBuild, myOutgoing, and WRITE_WARNING.

NBRequest::~NBRequest ( )

destructor

Definition at line 148 of file NBRequest.cpp.


Member Function Documentation

void NBRequest::buildBitfieldLogic ( bool  leftHanded)

builds the bitset-representation of the logic

Definition at line 152 of file NBRequest.cpp.

References computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), myIncoming, myOutgoing, and resetSignalised().

Referenced by NBNode::computeLogic().

void NBRequest::computeLeftOutgoingLinkCrossings ( bool  leftHanded,
NBEdge *  from,
NBEdge *  to 
) [private]

computes the relationships between links outgoing left of the given link

Definition at line 184 of file NBRequest.cpp.

References myAll, myJunction, NBContHelper::nextCW(), and setBlocking().

Referenced by buildBitfieldLogic().

void NBRequest::computeRightOutgoingLinkCrossings ( bool  leftHanded,
NBEdge *  from,
NBEdge *  to 
) [private]

computes the relationships between links outgoing right of the given link

Definition at line 166 of file NBRequest.cpp.

References myAll, myJunction, NBContHelper::nextCCW(), and setBlocking().

Referenced by buildBitfieldLogic().

size_t NBRequest::distanceCounterClockwise ( NBEdge *  from,
NBEdge *  to 
) [private]

returns the distance between the incoming (from) and the outgoing (to) edge clockwise in edges

Definition at line 306 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 throw ()

Returns the information whether the given flows cross.

Parameters:
[in]from1The starting edge of the first stream
[in]to1The ending edge of the first stream
[in]from2The starting edge of the second stream
[in]to2The ending edge of the second stream
Returns:
Whether both stream are foes (cross)

Definition at line 415 of file NBRequest.cpp.

Referenced by NBNode::foes(), resetSignalised(), and writeAreFoes().

bool NBRequest::forbids ( const NBEdge *const  possProhibitorFrom,
const NBEdge *const  possProhibitorTo,
const NBEdge *const  possProhibitedFrom,
const NBEdge *const  possProhibitedTo,
bool  regardNonSignalisedLowerPriority 
) const throw ()

Returns the information whether "prohibited" flow must let "prohibitor" flow pass.

Parameters:
[in]possProhibitorFromThe maybe prohibiting connection's begin
[in]possProhibitorToThe maybe prohibiting connection's end
[in]possProhibitedFromThe maybe prohibited connection's begin
[in]possProhibitedToThe maybe prohibited connection's end
[in]regardNonSignalisedLowerPriorityWhether the right of way rules without traffic lights shall be regarded
Returns:
Whether the first flow prohibits the second one

Definition at line 434 of file NBRequest.cpp.

Referenced by NBNode::forbids().

int NBRequest::getIndex ( const NBEdge *const  from,
const NBEdge *const  to 
) const throw () [private]

Returns the index to the internal combination container for the given edge combination.

If one of the edges is not known, -1 is returned.

Parameters:
[in]fromThe starting edge (incoming to this logic)
[in]toThe destination edge (outgoing from this logic)
Returns:
The index within the internal container

Definition at line 566 of file NBRequest.cpp.

Referenced by NBRequest(), resetSignalised(), setBlocking(), and writeAreFoes().

std::pair< unsigned int, unsigned int > NBRequest::getSizes ( ) const

returns the number of the junction's lanes and the number of the junction's links in respect.

Note:
: only connected lanes are counted

Definition at line 396 of file NBRequest.cpp.

References myIncoming.

Referenced by NBNode::computeLogic().

bool NBRequest::mustBrake ( const NBEdge *const  from,
const NBEdge *const  to 
) const throw ()

Returns the information whether the described flow must let any other flow pass.

Parameters:
[in]fromThe connection's start edge
[in]toThe connection's end edge
Returns:
Whether the described connection must brake (has higher priorised foes)

Definition at line 597 of file NBRequest.cpp.

bool NBRequest::mustBrake ( const NBEdge *const  possProhibitorFrom,
const NBEdge *const  possProhibitorTo,
const NBEdge *const  possProhibitedFrom,
const NBEdge *const  possProhibitedTo 
) const throw ()

Returns the information whether "prohibited" flow must let "prohibitor" flow pass.

Parameters:
[in]possProhibitorFromThe maybe prohibiting connection's begin
[in]possProhibitorToThe maybe prohibiting connection's end
[in]possProhibitedFromThe maybe prohibited connection's begin
[in]possProhibitedToThe maybe prohibited connection's end
Returns:
Whether the first flow prohibits the second one

Definition at line 621 of file NBRequest.cpp.

Referenced by NBNode::mustBrake().

void NBRequest::reportWarnings ( ) [static]

reports warnings if any occured

Definition at line 631 of file NBRequest.cpp.

References myGoodBuilds, myNotBuild, toString(), and WRITE_WARNING.

Referenced by NBNetBuilder::compute().

void NBRequest::resetSignalised ( ) [private]

Definition at line 336 of file NBRequest.cpp.

References foes(), getIndex(), myForbids, and myIncoming.

Referenced by buildBitfieldLogic().

void NBRequest::setBlocking ( bool  leftHanded,
NBEdge *  from1,
NBEdge *  to1,
NBEdge *  from2,
NBEdge *  to2 
) [private]

sets the information that the edge from1->to1 blocks the edge from2->to2 (is higher priorised than this)

Definition at line 202 of file NBRequest.cpp.

References getIndex(), NBEdge::getJunctionPriority(), NBNode::getType(), NBEdge::isTurningDirectionAt(), myAll, myDone, myForbids, myIncoming, myJunction, myOutgoing, NBContHelper::nextCW(), and NODETYPE_RIGHT_BEFORE_LEFT.

Referenced by computeLeftOutgoingLinkCrossings(), and computeRightOutgoingLinkCrossings().

void NBRequest::writeAreFoes ( OutputDevice &  od,
NBEdge *  from,
NBEdge *  to,
bool  isInnerEnd 
) const [private]

writes which participating links are foes to the given

Definition at line 531 of file NBRequest.cpp.

References foes(), getIndex(), myIncoming, and UNUSED_PARAMETER.

Referenced by writeLaneResponse().

int NBRequest::writeLaneResponse ( OutputDevice &  od,
NBEdge *  from,
int  lane,
int  pos 
) const [private]
void NBRequest::writeLogic ( std::string  key,
OutputDevice &  into 
) const

writes the XML-representation of the logic as a bitset-logic XML representation

Definition at line 323 of file NBRequest.cpp.

References myIncoming, and writeLaneResponse().

Referenced by NBNode::writeLogic().

void NBRequest::writeResponse ( OutputDevice &  od,
const NBEdge *const  from,
const NBEdge *const  to,
int  fromLane,
int  toLane,
bool  mayDefinitelyPass 
) const throw (IOError) [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).

Parameters:
[in]odThe stream to write the information to
[in]fromThe link's starting edge
[in]toThe link's destination edge
[in]fromLaneThe link's starting lane
[in]toLaneThe link's destination lane
[in]mayDefinitelyPassWhether this link is definitely not disturbed
Exceptions:
IOErrornot yet implemented

Definition at line 491 of file NBRequest.cpp.

References UNUSED_PARAMETER.

Referenced by writeLaneResponse().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const NBRequest &  r 
) [friend]

prints the request

Definition at line 578 of file NBRequest.cpp.


Field Documentation

const EdgeVector& NBRequest::myAll [private]

all (icoming and outgoing) of the junctions edges

Definition at line 206 of file NBRequest.h.

Referenced by computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), distanceCounterClockwise(), and setBlocking().

the link X link is done-checks

Definition at line 229 of file NBRequest.h.

Referenced by NBRequest(), and setBlocking().

the link X link blockings

Definition at line 226 of file NBRequest.h.

Referenced by NBRequest(), operator<<(), resetSignalised(), and setBlocking().

size_t NBRequest::myGoodBuilds = 0 [static, private]

Definition at line 232 of file NBRequest.h.

Referenced by NBRequest(), and reportWarnings().

edges incoming to the junction

Definition at line 209 of file NBRequest.h.

Referenced by buildBitfieldLogic(), getSizes(), NBRequest(), operator<<(), resetSignalised(), setBlocking(), writeAreFoes(), and writeLogic().

the node the request is assigned to

Definition at line 203 of file NBRequest.h.

Referenced by computeLeftOutgoingLinkCrossings(), computeRightOutgoingLinkCrossings(), and setBlocking().

size_t NBRequest::myNotBuild = 0 [private]

Definition at line 232 of file NBRequest.h.

Referenced by NBRequest(), and reportWarnings().

edges outgoing from the junction

Definition at line 212 of file NBRequest.h.

Referenced by buildBitfieldLogic(), NBRequest(), operator<<(), and setBlocking().


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