SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIPersonControl Class Reference

GUI-version of the person control for building gui persons. More...

#include <GUIPersonControl.h>

Inheritance diagram for GUIPersonControl:
MSPersonControl

Public Types

typedef std::map< std::string,
MSPerson * >::const_iterator 
constVehIt
 Definition of the internal persons map iterator. More...
 
typedef std::vector< MSPerson * > PersonVector
 Definition of a list of persons. More...
 

Public Member Functions

void abortWaiting ()
 aborts the plan for any person that is still waiting for a ride More...
 
bool add (const std::string &id, MSPerson *person)
 Adds a single person, returns false if an id clash occured. More...
 
void addWaiting (const MSEdge *edge, MSPerson *person)
 adds a person to the list of persons waiting for a vehicle on the specified edge More...
 
bool boardAnyWaiting (MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
 board any applicable persons Boards any people who wait on that edge for the given vehicle and removes them from myWaiting More...
 
virtual MSPersonbuildPerson (const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPerson::MSPersonPlan *plan) const
 Builds a new person. More...
 
void checkWaitingPersons (MSNet *net, const SUMOTime time)
 checks whether any persons waiting or walking time is over More...
 
virtual void erase (MSPerson *person)
 removes a single person More...
 
MSPersonget (const std::string &id) const
 Returns the named person, if existing. More...
 
 GUIPersonControl ()
 constructor More...
 
bool hasNonWaiting () const
 checks whether any person is still engaged in walking / stopping More...
 
bool hasPersons () const
 checks whether any person waits to finish her plan More...
 
void insertPersonIDs (std::vector< GUIGlID > &into)
 Returns the list of all known persons by gl-id. More...
 
bool isWaiting4Vehicle (const MSEdge *const edge, MSPerson *p) const
 returns whether the the given person is waiting for a vehicle on the given edge More...
 
constVehIt loadedPersonsBegin () const
 Returns the begin of the internal persons map. More...
 
constVehIt loadedPersonsEnd () const
 Returns the end of the internal persons map. More...
 
void setDeparture (SUMOTime time, MSPerson *person)
 sets the arrival time for a waiting or walking person More...
 
void setWaitEnd (SUMOTime time, MSPerson *person)
 sets the arrival time for a waiting or walking person More...
 
void setWalking (MSPerson *p)
 
unsigned int size () const
 Returns the number of known persons. More...
 
void unsetWalking (MSPerson *p)
 
virtual ~GUIPersonControl ()
 destructor More...
 

Protected Attributes

std::map< std::string, MSPerson * > myPersons
 all persons by id More...
 
std::map< SUMOTime, PersonVectormyWaiting4Departure
 Persons waiting for departure. More...
 
std::map< const MSEdge
*, PersonVector
myWaiting4Vehicle
 the lists of waiting persons More...
 
std::map< SUMOTime, PersonVectormyWaitingUntil
 the lists of walking / stopping persons More...
 
std::map< std::string, MSPerson * > myWalking
 all persons by id More...
 

Detailed Description

GUI-version of the person control for building gui persons.

Definition at line 45 of file GUIPersonControl.h.

Member Typedef Documentation

typedef std::map<std::string, MSPerson*>::const_iterator MSPersonControl::constVehIt
inherited

Definition of the internal persons map iterator.

Definition at line 65 of file MSPersonControl.h.

typedef std::vector<MSPerson*> MSPersonControl::PersonVector
inherited

Definition of a list of persons.

Definition at line 62 of file MSPersonControl.h.

Constructor & Destructor Documentation

GUIPersonControl::GUIPersonControl ( )

constructor

Definition at line 47 of file GUIPersonControl.cpp.

GUIPersonControl::~GUIPersonControl ( )
virtual

destructor

Definition at line 50 of file GUIPersonControl.cpp.

Member Function Documentation

void MSPersonControl::abortWaiting ( )
inherited

aborts the plan for any person that is still waiting for a ride

Definition at line 230 of file MSPersonControl.cpp.

References MSPersonControl::erase(), MSPerson::getID(), MSPersonControl::myWaiting4Vehicle, MSEdge::removePerson(), and WRITE_WARNING.

Referenced by MSNet::simulationState().

bool MSPersonControl::add ( const std::string &  id,
MSPerson person 
)
inherited

Adds a single person, returns false if an id clash occured.

Parameters
[in]idThe id of the person
[in]personThe person to add
Returns
Whether the person could be added (none with the same id existed before)

Definition at line 65 of file MSPersonControl.cpp.

References MSPersonControl::myPersons.

void MSPersonControl::addWaiting ( const MSEdge edge,
MSPerson person 
)
inherited

adds a person to the list of persons waiting for a vehicle on the specified edge

Definition at line 154 of file MSPersonControl.cpp.

References MSPersonControl::myWaiting4Vehicle.

Referenced by MSPerson::MSPersonStage_Driving::proceed().

bool MSPersonControl::boardAnyWaiting ( MSEdge edge,
MSVehicle vehicle,
MSVehicle::Stop stop 
)
inherited

board any applicable persons Boards any people who wait on that edge for the given vehicle and removes them from myWaiting

Parameters
[in]theedge on which the boarding should take place
[in]thevehicle which is taking on passengers
[in]thestop at which the vehicle is stopping
Returns
Whether any persons have been boarded

Definition at line 169 of file MSPersonControl.cpp.

References MSVehicle::addPerson(), MSVehicle::Stop::duration, MSVehicle::Stop::endPos, MSVehicleType::getBoardingDuration(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSBaseVehicle::getParameter(), MSVehicleType::getPersonCapacity(), MSVehicle::getPersonNumber(), MSBaseVehicle::getVehicleType(), SUMOVehicleParameter::id, SUMOVehicleParameter::line, MSPersonControl::myWaiting4Vehicle, MSEdge::removePerson(), MSVehicle::Stop::startPos, and MSVehicle::Stop::timeToBoardNextPerson.

Referenced by MSVehicle::processNextStop().

MSPerson * GUIPersonControl::buildPerson ( const SUMOVehicleParameter pars,
const MSVehicleType vtype,
MSPerson::MSPersonPlan plan 
) const
virtual

Builds a new person.

Parameters
[in]parsThe parameter
[in]vtypeThe type (reusing vehicle type container here)
[in]planThis person's plan

Reimplemented from MSPersonControl.

Definition at line 55 of file GUIPersonControl.cpp.

void MSPersonControl::checkWaitingPersons ( MSNet net,
const SUMOTime  time 
)
inherited

checks whether any persons waiting or walking time is over

Definition at line 129 of file MSPersonControl.cpp.

References MSPersonControl::erase(), MSPersonControl::myWaiting4Departure, and MSPersonControl::myWaitingUntil.

Referenced by MSNet::simulationStep().

MSPerson * MSPersonControl::get ( const std::string &  id) const
inherited

Returns the named person, if existing.

Parameters
[in]idThe id of the person
Returns
The named person, if existing, otherwise 0

Definition at line 75 of file MSPersonControl.cpp.

References MSPersonControl::myPersons.

Referenced by TraCIServerAPI_Person::getPosition(), TraCIServerAPI_Person::processGet(), and TraCIServerAPI_Person::processSet().

bool MSPersonControl::hasNonWaiting ( ) const
inherited

checks whether any person is still engaged in walking / stopping

Definition at line 209 of file MSPersonControl.cpp.

References MSPersonControl::myWaiting4Departure, MSPersonControl::myWaitingUntil, and MSPersonControl::myWalking.

Referenced by MSNet::simulationState().

bool MSPersonControl::hasPersons ( ) const
inherited

checks whether any person waits to finish her plan

Definition at line 203 of file MSPersonControl.cpp.

References MSPersonControl::myPersons.

Referenced by MSNet::simulationStep().

void GUIPersonControl::insertPersonIDs ( std::vector< GUIGlID > &  into)

Returns the list of all known persons by gl-id.

Parameters
fill]into The list to fill with vehicle ids
Todo:
Well, what about concurrent modifications?

Definition at line 61 of file GUIPersonControl.cpp.

References MSPersonControl::myPersons.

bool MSPersonControl::isWaiting4Vehicle ( const MSEdge *const  edge,
MSPerson p 
) const
inherited

returns whether the the given person is waiting for a vehicle on the given edge

Definition at line 163 of file MSPersonControl.cpp.

References MSPersonControl::myWaiting4Vehicle.

constVehIt MSPersonControl::loadedPersonsBegin ( ) const
inlineinherited

Returns the begin of the internal persons map.

Returns
The begin of the internal persons map

Definition at line 143 of file MSPersonControl.h.

References MSPersonControl::myPersons.

Referenced by TraCIServerAPI_Person::processGet().

constVehIt MSPersonControl::loadedPersonsEnd ( ) const
inlineinherited

Returns the end of the internal persons map.

Returns
The end of the internal persons map

Definition at line 151 of file MSPersonControl.h.

References MSPersonControl::myPersons.

Referenced by TraCIServerAPI_Person::processGet().

void MSPersonControl::setDeparture ( SUMOTime  time,
MSPerson person 
)
inherited

sets the arrival time for a waiting or walking person

Definition at line 109 of file MSPersonControl.cpp.

References DELTA_T, and MSPersonControl::myWaiting4Departure.

Referenced by MSRouteHandler::closePerson().

void MSPersonControl::setWaitEnd ( SUMOTime  time,
MSPerson person 
)
inherited

sets the arrival time for a waiting or walking person

Definition at line 119 of file MSPersonControl.cpp.

References DELTA_T, and MSPersonControl::myWaitingUntil.

Referenced by MSPerson::MSPersonStage_Waiting::proceed().

void MSPersonControl::setWalking ( MSPerson p)
inherited
unsigned int MSPersonControl::size ( ) const
inlineinherited

Returns the number of known persons.

Returns
The number of stored persons

Definition at line 159 of file MSPersonControl.h.

References MSPersonControl::myPersons.

Referenced by TraCIServerAPI_Person::processGet().

void MSPersonControl::unsetWalking ( MSPerson p)
inherited

Field Documentation

std::map<SUMOTime, PersonVector> MSPersonControl::myWaiting4Departure
protectedinherited

Persons waiting for departure.

Definition at line 172 of file MSPersonControl.h.

Referenced by MSPersonControl::checkWaitingPersons(), MSPersonControl::hasNonWaiting(), and MSPersonControl::setDeparture().

std::map<const MSEdge*, PersonVector> MSPersonControl::myWaiting4Vehicle
protectedinherited
std::map<SUMOTime, PersonVector> MSPersonControl::myWaitingUntil
protectedinherited

the lists of walking / stopping persons

Definition at line 175 of file MSPersonControl.h.

Referenced by MSPersonControl::checkWaitingPersons(), MSPersonControl::hasNonWaiting(), and MSPersonControl::setWaitEnd().

std::map<std::string, MSPerson*> MSPersonControl::myWalking
protectedinherited

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