MSPerson::MSPersonStage_Driving Class Reference

#include <MSPerson.h>

Inheritance diagram for MSPerson::MSPersonStage_Driving:

MSPerson::MSPersonStage

Detailed Description

A "real" stage performing the travelling by a transport system The given route will be chosen. The travel time is computed by the simulation

Definition at line 151 of file MSPerson.h.


Public Member Functions

const MSEdgegetDestination () const
 returns the destination edge
bool isWaitingFor (const std::string &line) const
 Whether the person waits for a vehicle of the line specified.
 MSPersonStage_Driving (const MSEdge &destination, const std::vector< std::string > &lines)
 constructor
virtual void proceed (MSNet *net, MSPerson *person, SUMOTime now, const MSEdge &previousEdge)
 proceeds to the next step
void setArrived (SUMOTime now)
 logs end of the step
void setDeparted (SUMOTime now)
 logs end of the step
virtual void tripInfoOutput (OutputDevice &os) const throw (IOError)
 Called on writing tripinfo output.
 ~MSPersonStage_Driving ()
 destructor

Protected Attributes

SUMOTime myArrived
 the time at which this stage ended
SUMOTime myDeparted
 the time at which this stage started
const MSEdgemyDestination
 the next edge to reach (either by walking or driving)

Private Member Functions

 MSPersonStage_Driving (const MSPersonStage_Driving &)
 Invalidated copy constructor.
MSPersonStage_Drivingoperator= (const MSPersonStage_Driving &)
 Invalidated assignment operator.

Private Attributes

const std::set< std::string > myLines
 the lines to choose from

Constructor & Destructor Documentation

MSPerson::MSPersonStage_Driving::MSPersonStage_Driving ( const MSEdge destination,
const std::vector< std::string > &  lines 
)

constructor

Definition at line 122 of file MSPerson.cpp.

00124         : MSPersonStage(destination), myLines(lines.begin(), lines.end()) {}

MSPerson::MSPersonStage_Driving::~MSPersonStage_Driving (  ) 

destructor

Definition at line 127 of file MSPerson.cpp.

00127 {}

MSPerson::MSPersonStage_Driving::MSPersonStage_Driving ( const MSPersonStage_Driving  )  [private]

Invalidated copy constructor.


Member Function Documentation

const MSEdge & MSPerson::MSPersonStage::getDestination (  )  const [inherited]

returns the destination edge

Definition at line 60 of file MSPerson.cpp.

References MSPerson::MSPersonStage::myDestination.

00060                                             {
00061     return myDestination;
00062 }

bool MSPerson::MSPersonStage_Driving::isWaitingFor ( const std::string &  line  )  const [virtual]

Whether the person waits for a vehicle of the line specified.

Reimplemented from MSPerson::MSPersonStage.

Definition at line 148 of file MSPerson.cpp.

References myLines.

00148                                                                        {
00149     return myLines.count(line) > 0;
00150 }

MSPersonStage_Driving& MSPerson::MSPersonStage_Driving::operator= ( const MSPersonStage_Driving  )  [private]

Invalidated assignment operator.

void MSPerson::MSPersonStage_Driving::proceed ( MSNet net,
MSPerson person,
SUMOTime  now,
const MSEdge previousEdge 
) [virtual]

proceeds to the next step

Implements MSPerson::MSPersonStage.

Definition at line 131 of file MSPerson.cpp.

References MSEmitControl::add(), MSVehicle::addPerson(), MSPersonControl::addWaiting(), MSVehicle::getDesiredDepart(), MSNet::getEmitControl(), MSNet::getInstance(), MSNet::getPersonControl(), MSNet::getVehicleControl(), MSVehicleControl::getWaitingVehicle(), myLines, and MSVehicleControl::removeWaiting().

00133                                     {
00134     MSVehicle *v = MSNet::getInstance()->getVehicleControl().getWaitingVehicle(&previousEdge, myLines);
00135     if (v != 0) {
00136         v->addPerson(person);
00137         if (v->getDesiredDepart() == -1) {
00138             MSNet::getInstance()->getEmitControl().add(v);
00139             MSNet::getInstance()->getVehicleControl().removeWaiting(&previousEdge, v);
00140         }
00141     } else {
00142         net->getPersonControl().addWaiting(&previousEdge, person);
00143     }
00144 }

void MSPerson::MSPersonStage::setArrived ( SUMOTime  now  )  [inherited]

logs end of the step

Definition at line 74 of file MSPerson.cpp.

References MSPerson::MSPersonStage::myArrived.

00074                                               {
00075     myArrived = now;
00076 }

void MSPerson::MSPersonStage::setDeparted ( SUMOTime  now  )  [inherited]

logs end of the step

Definition at line 66 of file MSPerson.cpp.

References MSPerson::MSPersonStage::myDeparted.

00066                                                {
00067     if (myDeparted < 0) {
00068         myDeparted = now;
00069     }
00070 }

void MSPerson::MSPersonStage_Driving::tripInfoOutput ( OutputDevice os  )  const throw (IOError) [virtual]

Called on writing tripinfo output.

Parameters:
[in] os The stream to write the information into
Exceptions:
IOError not yet implemented

Implements MSPerson::MSPersonStage.

Definition at line 154 of file MSPerson.cpp.

References MSPerson::MSPersonStage::myArrived, MSPerson::MSPersonStage::myDeparted, and time2string().

00154                                                                                    {
00155     (os.openTag("ride") <<
00156      " depart=\"" << time2string(myDeparted) <<
00157      "\" arrival=\"" << time2string(myArrived) <<
00158      "\"").closeTag(true);
00159 }


Field Documentation

the time at which this stage started

Definition at line 97 of file MSPerson.h.

Referenced by MSPerson::MSPersonStage::setDeparted(), and tripInfoOutput().

const MSEdge& MSPerson::MSPersonStage::myDestination [protected, inherited]

the next edge to reach (either by walking or driving)

Definition at line 94 of file MSPerson.h.

Referenced by MSPerson::MSPersonStage::getDestination().

const std::set<std::string> MSPerson::MSPersonStage_Driving::myLines [private]

the lines to choose from

Definition at line 175 of file MSPerson.h.

Referenced by isWaitingFor(), and proceed().


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

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