SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSDevice_Container.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A device which is used to keep track of containers riding with a vehicle
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef MSDevice_Container_h
22 #define MSDevice_Container_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 //#include <set>
35 #include <vector>
36 //#include <map>
37 #include "MSDevice.h"
38 #include <utils/common/SUMOTime.h>
39 #include <microsim/MSVehicle.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSLane;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
56 class MSDevice_Container : public MSDevice {
57 public:
65  static MSDevice_Container* buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
66 
67 
68 
69 public:
72 
73 
76 
86  bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
87 
88 
98 
99 
109  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos,
112 
113 
114 
119  void addContainer(MSContainer* container);
120 
121 
125  unsigned int size() const {
126  return static_cast<unsigned int>(myContainers.size());
127  }
128 
129 
133  const std::vector<MSContainer*>& getContainers() const {
134  return myContainers;
135  }
136 
137 
138 
139 private:
145  MSDevice_Container(SUMOVehicle& holder, const std::string& id);
146 
147 
148 
149 private:
151  std::vector<MSContainer*> myContainers;
152 
154  bool myStopped;
155 
156 
157 
158 private:
161 
164 
165 
166 };
167 
168 
169 #endif
170 
171 /****************************************************************************/
172 
std::vector< MSContainer * > myContainers
The containers of the vehicle.
void addContainer(MSContainer *container)
Add a container.
Notification
Definition of a vehicle state.
MSDevice_Container(SUMOVehicle &holder, const std::string &id)
Constructor.
static MSDevice_Container * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
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 container action is needed.
Representation of a vehicle.
Definition: SUMOVehicle.h:65
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Containers leaving on arrival.
~MSDevice_Container()
Destructor.
unsigned int size() const
Return the number of containers.
Abstract in-vehicle device.
Definition: MSDevice.h:69
MSDevice_Container & operator=(const MSDevice_Container &)
Invalidated assignment operator.
bool myStopped
Whether the vehicle is at a stop.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Adds containers on vehicle insertion.
const std::vector< MSContainer * > & getContainers() const
Returns the list of containers using this vehicle.
#define SUMOReal
Definition: config.h:218
Representation of a lane in the micro simulation.
Definition: MSLane.h:77