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-2018 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 /****************************************************************************/
15 // A device which stands as an implementation example and which outputs movereminder calls
16 /****************************************************************************/
17 #ifndef MSDevice_Bluelight_h
18 #define MSDevice_Bluelight_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSVehicleDevice.h"
27 #include <utils/common/SUMOTime.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class SUMOVehicle;
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(SUMOVehicle& veh, double oldPos,
88  double newPos, double newSpeed);
89 
90 
99  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
100 
101 
110  bool notifyLeave(SUMOVehicle& 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 
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into)
Build devices for the given vehicle, if needed.
double myCustomValue3
a value which is initialised based on a vType parameter
Notification
Definition of a vehicle state.
double myCustomValue1
a value which is initialised based on a commandline/configuration option
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
~MSDevice_Bluelight()
Destructor.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
std::set< std::string > influencedVehicles
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
void generateOutput() const
Called on writing tripinfo output.
MSDevice_Bluelight & operator=(const MSDevice_Bluelight &)
Invalidated assignment operator.
std::map< std::string, std::string > influencedTypes
MSDevice_Bluelight(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
const std::string deviceName() const
return the name for this type of device
A storage for options typed value containers)
Definition: OptionsCont.h:92
Abstract in-vehicle device.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
double myCustomValue2
a value which is initialised based on a vehicle parameter