MSBusStop Class Reference

#include <MSBusStop.h>

Inheritance diagram for MSBusStop:

MSTrigger Named GUIBusStop

Detailed Description

A lane area vehicles can halt at.

The bus stops tracks the last free space a vehicle may halt at by being informed about a vehicle's entering and depart. It keeps the information about entered vehicles' begin and end position within an internal container ("myEndPositions") and is so able to compute the last free space.

Please note that using the last free space disallows vehicles to enter a free space in between other vehicles.

Definition at line 59 of file MSBusStop.h.


Public Member Functions

void enter (void *what, SUMOReal beg, SUMOReal end) throw ()
 Called if a vehicle enters this stop.
SUMOReal getBeginLanePosition () const throw ()
 Returns the begin position of this bus stop.
SUMOReal getEndLanePosition () const throw ()
 Returns the end position of this bus stop.
const std::string & getID () const throw ()
 Returns the id.
const MSLanegetLane () const throw ()
 Returns the lane this bus stop is located at.
SUMOReal getLastFreePos () const throw ()
 Returns the last free position on this stop.
void leaveFrom (void *what) throw ()
 Called if a vehicle leaves this stop.
 MSBusStop (const std::string &id, const std::vector< std::string > &lines, MSLane &lane, SUMOReal begPos, SUMOReal endPos) throw ()
 Constructor.
virtual ~MSBusStop () throw ()
 Destructor.

Protected Member Functions

void computeLastFreePos () throw ()
 Computes the last free position on this stop.

Protected Attributes

SUMOReal myBegPos
 The begin position this bus stop is located at.
SUMOReal myEndPos
 The end position this bus stop is located at.
std::map< void *, std::pair
< SUMOReal, SUMOReal > > 
myEndPositions
 A map from objects (vehicles) to the areas they acquire after entering the stop.
std::string myID
 The name of the object.
MSLanemyLane
 The lane this bus stop is located at.
SUMOReal myLastFreePos
 The last free position at this stop (variable).
std::vector< std::string > myLines
 The list of lines that are assigned to this stop.

Private Member Functions

 MSBusStop (const MSBusStop &)
 Invalidated copy constructor.
MSBusStopoperator= (const MSBusStop &)
 Invalidated assignment operator.

Constructor & Destructor Documentation

MSBusStop::MSBusStop ( const std::string &  id,
const std::vector< std::string > &  lines,
MSLane lane,
SUMOReal  begPos,
SUMOReal  endPos 
) throw ()

Constructor.

Parameters:
[in] id The id of the bus stop
[in] net The net the bus stop belongs to
[in] lines Names of the bus lines that halt on this bus stop
[in] lane The lane the bus stop is placed on
[in] begPos Begin position of the bus stop on the lane
[in] endPos End position of the bus stop on the lane

Definition at line 42 of file MSBusStop.cpp.

00046         : MSTrigger(id), myLines(lines), myLane(lane),
00047         myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos) {
00048     computeLastFreePos();
00049 }

MSBusStop::~MSBusStop (  )  throw () [virtual]

Destructor.

Definition at line 52 of file MSBusStop.cpp.

00052 {}

MSBusStop::MSBusStop ( const MSBusStop  )  [private]

Invalidated copy constructor.


Member Function Documentation

void MSBusStop::computeLastFreePos (  )  throw () [protected]

Computes the last free position on this stop.

The last free position is the one, the last vehicle ends at. It is stored in myLastFreePos. If no vehicle halts, the last free position gets the value of myEndPos.

Definition at line 95 of file MSBusStop.cpp.

References myEndPos, myEndPositions, and myLastFreePos.

Referenced by enter(), and leaveFrom().

00095                                       {
00096     myLastFreePos = myEndPos;
00097     std::map<void*, std::pair<SUMOReal, SUMOReal> >::iterator i;
00098     for (i=myEndPositions.begin(); i!=myEndPositions.end(); i++) {
00099         if (myLastFreePos>(*i).second.second) {
00100             myLastFreePos = (*i).second.second;
00101         }
00102     }
00103 }

void MSBusStop::enter ( void *  what,
SUMOReal  beg,
SUMOReal  end 
) throw ()

Called if a vehicle enters this stop.

Stores the position of the entering vehicle in myEndPositions.

Recomputes the free space using "computeLastFreePos" then.

Parameters:
[in] what The vehicle that enters the bus stop
[in] beg The begin halting position of the vehicle
[in] what The end halting position of the vehicle
See also:
computeLastFreePos

Definition at line 74 of file MSBusStop.cpp.

References computeLastFreePos(), and myEndPositions.

Referenced by MSVehicle::processNextStop().

00074                                                                {
00075     myEndPositions[what] = std::pair<SUMOReal, SUMOReal>(beg, end);
00076     computeLastFreePos();
00077 }

SUMOReal MSBusStop::getBeginLanePosition (  )  const throw ()

Returns the begin position of this bus stop.

Returns:
The position the bus stop begins at

Definition at line 62 of file MSBusStop.cpp.

References myBegPos.

Referenced by MSVehicle::processNextStop().

00062                                               {
00063     return myBegPos;
00064 }

SUMOReal MSBusStop::getEndLanePosition (  )  const throw ()

Returns the end position of this bus stop.

Returns:
The position the bus stop ends at

Definition at line 68 of file MSBusStop.cpp.

References myEndPos.

Referenced by MSNet::getBusStopID(), and MSRouteHandler::myStartElement().

00068                                             {
00069     return myEndPos;
00070 }

const std::string& Named::getID (  )  const throw () [inline, inherited]

Returns the id.

Returns:
The stored id

Definition at line 59 of file Named.h.

References Named::myID.

Referenced by RORouteDef_Alternatives::addAlternative(), MSRouteProbe::addRoute(), MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), MSCalibrator::MSCalibrator_FileTriggeredChild::buildAndScheduleFlowVehicle(), RORouteDef_Complete::buildCurrentRoute(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectLinks(), NBTrafficLightDefinition::compute(), GUIPointOfInterest::drawGL(), MSInductLoop::enterDetectorByMove(), MSVTypeProbe::execute(), MSNet::getBusStopID(), GUITriggeredRerouter::getMicrosimID(), GUIPointOfInterest::getMicrosimID(), GUILaneSpeedTrigger::getMicrosimID(), GUIInductLoop::MyWrapper::getMicrosimID(), GUIEmitter::getMicrosimID(), GUIBusStop::getMicrosimID(), GUI_E2_ZS_Collector::MyWrapper::getMicrosimID(), traci::TraCIServer::handlePoiDomain(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), MSTriggeredRerouter::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), MSCalibrator::MSCalibrator_FileTriggeredChild::myStartElement(), NBLoadedTLDef::SignalGroup::patchTYellow(), TraCIServerAPI_Vehicle::processGet(), MSVehicle::replaceRoute(), MSVehicle::saveState(), NBOwnTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), RORDLoader_SUMOBase::startRoute(), GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute(), NBTrafficLightLogic::writeXML(), MSRouteProbe::writeXMLOutput(), MSInductLoop::writeXMLOutput(), MSE2Collector::writeXMLOutput(), and MSVehicle::~MSVehicle().

00059                                            {
00060         return myID;
00061     }

const MSLane & MSBusStop::getLane (  )  const throw ()

Returns the lane this bus stop is located at.

Returns:
Reference to the lane the bus stop is located at

Definition at line 56 of file MSBusStop.cpp.

References myLane.

Referenced by MSNet::getBusStopID(), and MSRouteHandler::myStartElement().

00056                                  {
00057     return myLane;
00058 }

SUMOReal MSBusStop::getLastFreePos (  )  const throw ()

Returns the last free position on this stop.

Returns:
The last free position of this bus stop

Definition at line 81 of file MSBusStop.cpp.

References myLastFreePos.

Referenced by MSVehicle::getBestLanes(), MSVehicle::processNextStop(), and MSVehicle::rebuildContinuationsFor().

00081                                         {
00082     return myLastFreePos;
00083 }

void MSBusStop::leaveFrom ( void *  what  )  throw ()

Called if a vehicle leaves this stop.

Removes the position of the vehicle from myEndPositions.

Recomputes the free space using "computeLastFreePos" then.

Parameters:
[in] what The vehicle that leaves the bus stop
See also:
computeLastFreePos

Definition at line 87 of file MSBusStop.cpp.

References computeLastFreePos(), and myEndPositions.

00087                                        {
00088     assert(myEndPositions.find(what)!=myEndPositions.end());
00089     myEndPositions.erase(myEndPositions.find(what));
00090     computeLastFreePos();
00091 }

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

Invalidated assignment operator.


Field Documentation

SUMOReal MSBusStop::myBegPos [protected]

The begin position this bus stop is located at.

Definition at line 154 of file MSBusStop.h.

Referenced by getBeginLanePosition().

SUMOReal MSBusStop::myEndPos [protected]

The end position this bus stop is located at.

Definition at line 157 of file MSBusStop.h.

Referenced by computeLastFreePos(), and getEndLanePosition().

std::map<void*, std::pair<SUMOReal, SUMOReal> > MSBusStop::myEndPositions [protected]

A map from objects (vehicles) to the areas they acquire after entering the stop.

Definition at line 148 of file MSBusStop.h.

Referenced by computeLastFreePos(), enter(), and leaveFrom().

std::string Named::myID [protected, inherited]

MSLane& MSBusStop::myLane [protected]

The lane this bus stop is located at.

Definition at line 151 of file MSBusStop.h.

Referenced by getLane().

SUMOReal MSBusStop::myLastFreePos [protected]

The last free position at this stop (variable).

Definition at line 160 of file MSBusStop.h.

Referenced by computeLastFreePos(), and getLastFreePos().

std::vector<std::string> MSBusStop::myLines [protected]

The list of lines that are assigned to this stop.

Definition at line 145 of file MSBusStop.h.

Referenced by GUIBusStop::drawGL().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:46 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6