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-2016 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 
120  int size() const {
121  return (int)myTransportables.size();
122  }
123 
124 
128  const std::vector<MSTransportable*>& getTransportables() const {
129  return myTransportables;
130  }
131 
132 
133 
134 private:
140  MSDevice_Transportable(SUMOVehicle& holder, const std::string& id, const bool isContainer);
141 
142 
143 
144 private:
147 
149  std::vector<MSTransportable*> myTransportables;
150 
152  bool myStopped;
153 
154 
155 private:
158 
161 
162 
163 };
164 
165 
166 #endif
167 
168 /****************************************************************************/
169 
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
int size() const
Return the number of passengers / containers.
Notification
Definition of a vehicle state.
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into, const bool isContainer)
Build devices for the given vehicle, if needed.
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:66
void addTransportable(MSTransportable *transportable)
Add a passenger.
bool myAmContainer
Whether it is a container device.
Abstract in-vehicle device.
Definition: MSDevice.h:69
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:213
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.
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Passengers leaving on arrival.