SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSDevice_Person.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A device which is used to keep track of Persons riding with a vehicle
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSDevice_Person_h
23 #define MSDevice_Person_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <set>
36 #include <vector>
37 #include <map>
38 #include "MSDevice.h"
39 #include <utils/common/SUMOTime.h>
40 #include <microsim/MSVehicle.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MSLane;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
57 class MSDevice_Person : public MSDevice {
58 public:
66  static MSDevice_Person* buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
67 
68 
69 
70 public:
73 
74 
77 
87  bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
88 
89 
99 
100 
110  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos,
113 
114 
115 
120  void addPerson(MSPerson* person);
121 
122 
126  unsigned int size() const {
127  return static_cast<unsigned int>(myPersons.size());
128  }
129 
130 
134  const std::vector<MSPerson*>& getPersons() const {
135  return myPersons;
136  }
137 
138 
139 
140 private:
146  MSDevice_Person(SUMOVehicle& holder, const std::string& id);
147 
148 
149 
150 private:
152  std::vector<MSPerson*> myPersons;
153 
155  bool myStopped;
156 
157 
158 
159 private:
162 
165 
166 
167 };
168 
169 
170 #endif
171 
172 /****************************************************************************/
173 
~MSDevice_Person()
Destructor.
bool myStopped
Whether the vehicle is at a stop.
static MSDevice_Person * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
Notification
Definition of a vehicle state.
MSDevice_Person & operator=(const MSDevice_Person &)
Invalidated assignment operator.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks whether the vehicle is at a stop and person action is needed.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Adds passengers on vehicle insertion.
Representation of a vehicle.
Definition: SUMOVehicle.h:63
void addPerson(MSPerson *person)
Add a passenger.
const std::vector< MSPerson * > & getPersons() const
Returns the list of persons using this vehicle.
Abstract in-vehicle device.
Definition: MSDevice.h:68
MSDevice_Person(SUMOVehicle &holder, const std::string &id)
Constructor.
std::vector< MSPerson * > myPersons
The passengers of the vehicle.
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Passengers leaving on arrival.
#define SUMOReal
Definition: config.h:215
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
unsigned int size() const
Return the number of passengers.