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 /****************************************************************************/
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 class SUMOTrafficObject;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
49 public:
53  static void insertOptions(OptionsCont& oc);
54 
55 
66  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
67 
68 
69 
70 public:
73 
74 
75 
78 
88  bool notifyMove(SUMOTrafficObject& veh, double oldPos,
89  double newPos, double newSpeed);
90 
91 
100  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
101 
102 
111  bool notifyLeave(SUMOTrafficObject& veh, double lastPos,
112  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
114 
115 
117  const std::string deviceName() const {
118  return "bluelight";
119  }
120 
122  std::string getParameter(const std::string& key) const;
123 
125  void setParameter(const std::string& key, const std::string& value);
126 
133  void generateOutput() const;
134 
135 
136 
137 private:
143  MSDevice_Bluelight(SUMOVehicle& holder, const std::string& id, double customValue1,
144  double customValue2, double customValue3);
145 
146 
147 
148 private:
149  // @brief collects all vehicleIDs which had to react to the emergency vehicle
150  std::set<std::string> influencedVehicles;
151 
152  // @brief collects all VehicleTypes of the vehicles which had to react to the emergency vehicle
153  std::map<std::string, std::string> influencedTypes;
154 
157 
160 
163 
164 
165 
166 private:
169 
172 
173 
174 };
175 
176 
177 #endif
178 
179 /****************************************************************************/
180 
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
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
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
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:61
std::set< std::string > influencedVehicles
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.
Representation of a vehicle or person.
const std::string deviceName() const
return the name for this type of device
A storage for options typed value containers)
Definition: OptionsCont.h:90
Abstract in-vehicle device.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
double myCustomValue2
a value which is initialised based on a vehicle parameter