SUMO - Simulation of Urban MObility
MSDevice_Example.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A device which stands as an implementation example and which outputs movereminder calls
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 200132014 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_Example_h
22 #define MSDevice_Example_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 "MSDevice.h"
35 #include <utils/common/SUMOTime.h>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class SUMOVehicle;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
55 class MSDevice_Example : public MSDevice {
56 public:
60  static void insertOptions(OptionsCont& oc);
61 
62 
73  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
74 
75 
76 
77 public:
80 
81 
82 
85 
95  bool notifyMove(SUMOVehicle& veh, double oldPos,
96  double newPos, double newSpeed);
97 
98 
107  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
108 
109 
118  bool notifyLeave(SUMOVehicle& veh, double lastPos,
119  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
121 
122 
124  const std::string deviceName() const {
125  return "example";
126  }
127 
129  std::string getParameter(const std::string& key) const;
130 
132  void setParameter(const std::string& key, const std::string& value);
133 
140  void generateOutput() const;
141 
142 
143 
144 private:
150  MSDevice_Example(SUMOVehicle& holder, const std::string& id, double customValue1,
151  double customValue2, double customValue3);
152 
153 
154 
155 private:
156  // private state members of the Example device
157 
160 
163 
166 
167 
168 
169 private:
172 
175 
176 
177 };
178 
179 
180 #endif
181 
182 /****************************************************************************/
183 
~MSDevice_Example()
Destructor.
double myCustomValue1
a value which is initialised based on a commandline/configuration option
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
Notification
Definition of a vehicle state.
MSDevice_Example(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
MSDevice_Example & operator=(const MSDevice_Example &)
Invalidated assignment operator.
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Representation of a vehicle.
Definition: SUMOVehicle.h:67
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< MSDevice *> &into)
Build devices for the given vehicle, if needed.
Abstract in-vehicle device.
Definition: MSDevice.h:71
void generateOutput() const
Called on writing tripinfo output.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
A storage for options typed value containers)
Definition: OptionsCont.h:99
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
double myCustomValue2
a value which is initialised based on a vehicle parameter
const std::string deviceName() const
return the name for this type of device
double myCustomValue3
a value which is initialised based on a vType parameter