SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSPerson.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The class for modelling person-movements
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13 // Copyright (C) 2001-2012 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 MSPerson_h
24 #define MSPerson_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 <string>
37 #include <vector>
38 #include <set>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSNet;
45 class MSEdge;
46 class OutputDevice;
48 
49 typedef std::vector<const MSEdge*> MSEdgeVector;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
60 class MSPerson {
61 public:
66  class MSPersonStage {
67  public:
69  MSPersonStage(const MSEdge& destination);
70 
72  virtual ~MSPersonStage();
73 
75  const MSEdge& getDestination() const;
76 
78  virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, const MSEdge& previousEdge) = 0;
79 
81  void setDeparted(SUMOTime now);
82 
84  void setArrived(SUMOTime now);
85 
87  virtual bool isWaitingFor(const std::string& line) const;
88 
94  virtual void tripInfoOutput(OutputDevice& os) const = 0;
95 
96 
97  protected:
100 
103 
106 
107  private:
110 
113 
114  };
115 
122  public:
124  MSPersonStage_Walking(MSEdgeVector route, SUMOTime walkingTime, SUMOReal speed);
125 
128 
130  virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, const MSEdge& previousEdge);
131 
137  virtual void tripInfoOutput(OutputDevice& os) const;
138 
139  private:
142 
143  private:
146 
149 
150  };
151 
157  public:
159  MSPersonStage_Driving(const MSEdge& destination,
160  const std::vector<std::string> &lines);
161 
164 
166  virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, const MSEdge& previousEdge);
167 
169  bool isWaitingFor(const std::string& line) const;
170 
176  virtual void tripInfoOutput(OutputDevice& os) const;
177 
178  private:
180  const std::set<std::string> myLines;
181 
182  private:
185 
188 
189  };
190 
195  public:
197  MSPersonStage_Waiting(const MSEdge& destination, SUMOTime duration, SUMOTime until);
198 
201 
203  virtual void proceed(MSNet* net, MSPerson* person, SUMOTime now, const MSEdge& previousEdge);
204 
210  virtual void tripInfoOutput(OutputDevice& os) const;
211 
212  private:
215 
218 
219  private:
222 
225 
226  };
227 
228 public:
230  typedef std::vector<MSPersonStage*> MSPersonPlan;
231 
232 private:
235 
238 
240  MSPersonPlan::iterator myStep;
241 
242 public:
244  MSPerson(const SUMOVehicleParameter* pars, MSPersonPlan* plan);
245 
247  ~MSPerson();
248 
250  const std::string& getID() const ;
251 
253  void proceed(MSNet* net, SUMOTime time);
254 
256  SUMOTime getDesiredDepart() const ;
257 
259  void setDeparted(SUMOTime now);
260 
262  const MSEdge& getDestination() const;
263 
269  void tripInfoOutput(OutputDevice& os) const;
270 
272  bool isWaitingFor(const std::string& line) const;
273 
274 private:
276  MSPerson(const MSPerson&);
277 
279  MSPerson& operator=(const MSPerson&);
280 
281 };
282 
283 
284 #endif
285 
286 /****************************************************************************/