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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A device which stands as an implementation example and which outputs movereminder calls
19 /****************************************************************************/
20 #ifndef MSDevice_Bluelight_h
21 #define MSDevice_Bluelight_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "MSDevice.h"
34 #include <utils/common/SUMOTime.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class SUMOVehicle;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
54 class MSDevice_Bluelight : public MSDevice {
55 public:
59  static void insertOptions(OptionsCont& oc);
60 
61 
72  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
73 
74 
75 
76 public:
79 
80 
81 
84 
94  bool notifyMove(SUMOVehicle& veh, double oldPos,
95  double newPos, double newSpeed);
96 
97 
106  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
107 
108 
117  bool notifyLeave(SUMOVehicle& veh, double lastPos,
118  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
120 
121 
123  const std::string deviceName() const {
124  return "example";
125  }
126 
128  std::string getParameter(const std::string& key) const;
129 
131  void setParameter(const std::string& key, const std::string& value);
132 
139  void generateOutput() const;
140 
141 
142 
143 private:
149  MSDevice_Bluelight(SUMOVehicle& holder, const std::string& id, double customValue1,
150  double customValue2, double customValue3);
151 
152 
153 
154 private:
155  // private state members of the Example device
156 
159 
162 
165 
166 
167 
168 private:
171 
174 
175 
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
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:66
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
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.
MSDevice_Bluelight(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
Abstract in-vehicle device.
Definition: MSDevice.h:70
const std::string deviceName() const
return the name for this type of device
A storage for options typed value containers)
Definition: OptionsCont.h:98
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:77
double myCustomValue2
a value which is initialised based on a vehicle parameter