SUMO - Simulation of Urban MObility
MSDevice.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Abstract in-vehicle device
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSDevice_h
23 #define MSDevice_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <set>
40 #include <utils/common/Named.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class OutputDevice;
48 class SUMOVehicle;
49 class OptionsCont;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
69 class MSDevice : public MSMoveReminder, public Named {
70 public:
74  static void insertOptions(OptionsCont& oc);
75 
79  static bool checkOptions(OptionsCont& oc);
80 
81 
87  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
88 
89 
90 
91 public:
97  MSDevice(SUMOVehicle& holder, const std::string& id) :
98  MSMoveReminder(id), Named(id), myHolder(holder) {
99  }
100 
101 
103  virtual ~MSDevice() { }
104 
105 
111  return myHolder;
112  }
113 
114 
127  virtual void generateOutput() const {
128  }
129 
130 
131 
132 protected:
135 
142  static void insertDefaultAssignmentOptions(const std::string& deviceName, const std::string& optionsTopic, OptionsCont& oc);
143 
144 
151  static bool equippedByDefaultAssignmentOptions(const OptionsCont& oc, const std::string& deviceName, SUMOVehicle& v);
153 
154 
155 
156 protected:
159 
160 
161 
162 private:
164  static std::map<std::string, std::set<std::string> > myExplicitIDs;
165 
166 
167 private:
169  MSDevice(const MSDevice&);
170 
172  MSDevice& operator=(const MSDevice&);
173 
174 };
175 
176 
177 #endif
178 
179 /****************************************************************************/
180 
virtual ~MSDevice()
Destructor.
Definition: MSDevice.h:103
SUMOVehicle & myHolder
The vehicle that stores the device.
Definition: MSDevice.h:158
static std::map< std::string, std::set< std::string > > myExplicitIDs
vehicles which explicitly carry a device, sorted by device, first
Definition: MSDevice.h:164
virtual void generateOutput() const
Called on writing tripinfo output.
Definition: MSDevice.h:127
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice.cpp:81
Representation of a vehicle.
Definition: SUMOVehicle.h:66
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
Definition: MSDevice.cpp:94
Something on a lane to be noticed about vehicle movement.
Base class for objects which have an id.
Definition: Named.h:46
static bool checkOptions(OptionsCont &oc)
check device-specific options
Definition: MSDevice.cpp:73
Abstract in-vehicle device.
Definition: MSDevice.h:69
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
Definition: MSDevice.cpp:108
A storage for options typed value containers)
Definition: OptionsCont.h:99
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
Definition: MSDevice.cpp:62
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
MSDevice & operator=(const MSDevice &)
Invalidated assignment operator.
MSDevice(SUMOVehicle &holder, const std::string &id)
Constructor.
Definition: MSDevice.h:97
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
Definition: MSDevice.h:110