Eclipse SUMO - Simulation of Urban MObility
MSDevice_Bluelight.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // A device which stands as an implementation example and which outputs movereminder calls
15 /****************************************************************************/
16 #ifndef MSDevice_Bluelight_h
17 #define MSDevice_Bluelight_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include "MSVehicleDevice.h"
26 #include <utils/common/SUMOTime.h>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class SUMOVehicle;
33 class SUMOTrafficObject;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
48 public:
52  static void insertOptions(OptionsCont& oc);
53 
54 
65  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
66 
67 
68 
69 public:
72 
73 
74 
77 
87  bool notifyMove(SUMOTrafficObject& veh, double oldPos,
88  double newPos, double newSpeed);
89 
90 
99  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
100 
101 
110  bool notifyLeave(SUMOTrafficObject& veh, double lastPos,
111  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
113 
114 
116  const std::string deviceName() const {
117  return "bluelight";
118  }
119 
121  std::string getParameter(const std::string& key) const;
122 
124  void setParameter(const std::string& key, const std::string& value);
125 
132  void generateOutput() const;
133 
134 
135 
136 private:
142  MSDevice_Bluelight(SUMOVehicle& holder, const std::string& id, double customValue1,
143  double customValue2, double customValue3);
144 
145 
146 
147 private:
148  // @brief collects all vehicleIDs which had to react to the emergency vehicle
149  std::set<std::string> influencedVehicles;
150 
151  // @brief collects all VehicleTypes of the vehicles which had to react to the emergency vehicle
152  std::map<std::string, std::string> influencedTypes;
153 
156 
159 
162 
163 
164 
165 private:
168 
171 
172 
173 };
174 
175 
176 #endif
177 
178 /****************************************************************************/
179 
MSDevice_Bluelight::notifyLeave
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
Definition: MSDevice_Bluelight.cpp:222
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
SUMOTime.h
MSDevice_Bluelight::MSDevice_Bluelight
MSDevice_Bluelight(const MSDevice_Bluelight &)
Invalidated copy constructor.
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSVehicleDevice.h
MSDevice_Bluelight::buildVehicleDevices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice_Bluelight.cpp:59
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSDevice_Bluelight::MSDevice_Bluelight
MSDevice_Bluelight(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
Definition: MSDevice_Bluelight.cpp:103
MSDevice_Bluelight::influencedTypes
std::map< std::string, std::string > influencedTypes
Definition: MSDevice_Bluelight.h:152
MSDevice_Bluelight::myCustomValue1
double myCustomValue1
a value which is initialised based on a commandline/configuration option
Definition: MSDevice_Bluelight.h:155
MSDevice_Bluelight::getParameter
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
Definition: MSDevice_Bluelight.cpp:245
MSDevice_Bluelight::myCustomValue2
double myCustomValue2
a value which is initialised based on a vehicle parameter
Definition: MSDevice_Bluelight.h:158
MSDevice_Bluelight::influencedVehicles
std::set< std::string > influencedVehicles
Definition: MSDevice_Bluelight.h:149
MSDevice_Bluelight::generateOutput
void generateOutput() const
Called on writing tripinfo output.
Definition: MSDevice_Bluelight.cpp:234
MSDevice_Bluelight::setParameter
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
Definition: MSDevice_Bluelight.cpp:258
MSDevice_Bluelight::myCustomValue3
double myCustomValue3
a value which is initialised based on a vType parameter
Definition: MSDevice_Bluelight.h:161
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSDevice_Bluelight::deviceName
const std::string deviceName() const
return the name for this type of device
Definition: MSDevice_Bluelight.h:116
MSDevice_Bluelight::notifyEnter
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
Definition: MSDevice_Bluelight.cpp:210
MSDevice_Bluelight::~MSDevice_Bluelight
~MSDevice_Bluelight()
Destructor.
Definition: MSDevice_Bluelight.cpp:115
MSDevice_Bluelight::operator=
MSDevice_Bluelight & operator=(const MSDevice_Bluelight &)
Invalidated assignment operator.
config.h
MSDevice_Bluelight::notifyMove
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Definition: MSDevice_Bluelight.cpp:120
MSDevice_Bluelight::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
Definition: MSDevice_Bluelight.cpp:48
MSDevice_Bluelight
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Bluelight.h:47
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSVehicleDevice
Abstract in-vehicle device.
Definition: MSVehicleDevice.h:54