SUMO - Simulation of Urban MObility
MSDevice_Transportable.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // A device which is used to keep track of persons and containers riding with a vehicle
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
14 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef MSDevice_Transportable_h
25 #define MSDevice_Transportable_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <vector>
38 #include "MSDevice.h"
39 #include <utils/common/SUMOTime.h>
40 #include <microsim/MSVehicle.h>
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
52 public:
60  static MSDevice_Transportable* buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into, const bool isContainer);
61 
62 
63 
64 public:
67 
68 
71 
81  bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
82 
83 
93 
94 
104  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos,
107 
108 
109 
114  void addTransportable(MSTransportable* transportable);
115 
116 
121  void removeTransportable(MSTransportable* transportable);
122 
123 
127  int size() const {
128  return (int)myTransportables.size();
129  }
130 
131 
135  const std::vector<MSTransportable*>& getTransportables() const {
136  return myTransportables;
137  }
138 
139 
140 
141 private:
147  MSDevice_Transportable(SUMOVehicle& holder, const std::string& id, const bool isContainer);
148 
149 
150 
151 private:
154 
156  std::vector<MSTransportable*> myTransportables;
157 
159  bool myStopped;
160 
161 
162 private:
165 
168 
169 
170 };
171 
172 
173 #endif
174 
175 /****************************************************************************/
176 
Notification
Definition of a vehicle state.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Adds passengers on vehicle insertion.
MSDevice_Transportable & operator=(const MSDevice_Transportable &)
Invalidated assignment operator.
Representation of a vehicle.
Definition: SUMOVehicle.h:67
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
void addTransportable(MSTransportable *transportable)
Add a passenger.
bool myAmContainer
Whether it is a container device.
Abstract in-vehicle device.
Definition: MSDevice.h:69
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into, const bool isContainer)
Build devices for the given vehicle, if needed.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks whether the vehicle is at a stop and transportable action is needed.
#define SUMOReal
Definition: config.h:208
MSDevice_Transportable(SUMOVehicle &holder, const std::string &id, const bool isContainer)
Constructor.
bool myStopped
Whether the vehicle is at a stop.
std::vector< MSTransportable * > myTransportables
The passengers of the vehicle.
void removeTransportable(MSTransportable *transportable)
Remove a passenger (TraCI)
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Passengers leaving on arrival.
int size() const
Return the number of passengers / containers.