SUMO - Simulation of Urban MObility
MSPersonControl.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Stores all persons in the net and handles their waiting for cars.
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSPersonControl_h
24 #define MSPersonControl_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <map>
38 #include "MSPerson.h"
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSNet;
45 class MSVehicle;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
59 public:
60 
61  typedef std::vector<MSPerson*> PersonVector;
62 
65 
67  virtual ~MSPersonControl();
68 
70  bool add(const std::string& id, MSPerson* person);
71 
73  virtual void erase(MSPerson* person);
74 
76  void setDeparture(SUMOTime time, MSPerson* person);
77 
79  void setWaitEnd(SUMOTime time, MSPerson* person);
80 
82  void checkWaitingPersons(MSNet* net, const SUMOTime time);
83 
85  void addWaiting(const MSEdge* edge, MSPerson* person);
86 
93  bool boardAnyWaiting(MSEdge* edge, MSVehicle* vehicle);
94 
96  bool hasPersons() const;
97 
99  bool hasNonWaiting() const;
100 
102  void abortWaiting();
103 
104 
110  virtual MSPerson* buildPerson(const SUMOVehicleParameter* pars, const MSVehicleType* vtype, MSPerson::MSPersonPlan* plan) const;
111 
112  void setWalking(MSPerson* p);
113  void unsetWalking(MSPerson* p);
114 
116  bool isWaiting4Vehicle(const MSEdge* const edge, MSPerson* p) const;
117 
118  const std::map<std::string, MSPerson*>& getPersons() const {
119  return myPersons;
120  }
121 
122 private:
124  std::map<std::string, MSPerson*> myPersons;
125 
127  std::map<std::string, MSPerson*> myWalking;
128 
130  std::map<SUMOTime, PersonVector> myWaiting4Departure;
131 
133  std::map<SUMOTime, PersonVector> myWaitingUntil;
134 
136  std::map<const MSEdge*, PersonVector> myWaiting4Vehicle;
137 
138 };
139 
140 
141 #endif
142 
143 /****************************************************************************/
virtual MSPerson * buildPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPerson::MSPersonPlan *plan) const
Builds a new person.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
std::map< std::string, MSPerson * > myWalking
all persons by id
std::map< SUMOTime, PersonVector > myWaiting4Departure
Persons waiting for departure.
MSPersonControl()
constructor
The simulated network and simulation perfomer.
Definition: MSNet.h:91
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool hasPersons() const
checks whether any person waits to finish her plan
std::map< std::string, MSPerson * > myPersons
all persons by id
A road/street connecting two junctions.
Definition: MSEdge.h:74
bool add(const std::string &id, MSPerson *person)
adds a single person, returns false if an id clash occured
void abortWaiting()
aborts the plan for any person that is still waiting for a ride
void addWaiting(const MSEdge *edge, MSPerson *person)
adds a person to the list of persons waiting for a vehicle on the specified edge
void checkWaitingPersons(MSNet *net, const SUMOTime time)
checks whether any persons waiting or walking time is over
void setWaitEnd(SUMOTime time, MSPerson *person)
sets the arrival time for a waiting or walking person
void unsetWalking(MSPerson *p)
std::map< const MSEdge *, PersonVector > myWaiting4Vehicle
the lists of waiting persons
bool hasNonWaiting() const
checks whether any person is still engaged in walking / stopping
Structure representing possible vehicle parameter.
void setWalking(MSPerson *p)
std::map< SUMOTime, PersonVector > myWaitingUntil
the lists of walking / stopping persons
void setDeparture(SUMOTime time, MSPerson *person)
sets the arrival time for a waiting or walking person
const std::map< std::string, MSPerson * > & getPersons() const
std::vector< MSPerson * > PersonVector
virtual void erase(MSPerson *person)
removes a single person
std::vector< MSPersonStage * > MSPersonPlan
the structure holding the plan of a person
Definition: MSPerson.h:515
virtual ~MSPersonControl()
destructor
bool isWaiting4Vehicle(const MSEdge *const edge, MSPerson *p) const
returns whether the the given person is waiting for a vehicle on the given edge