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 
76 
82  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
83 
84 
85 
86 public:
92  MSDevice(SUMOVehicle& holder, const std::string& id) :
93  MSMoveReminder(id), Named(id), myHolder(holder) {
94  }
95 
96 
98  virtual ~MSDevice() { }
99 
100 
106  return myHolder;
107  }
108 
109 
122  virtual void generateOutput() const {
123  }
124 
125 
126 
127 protected:
130 
137  static void insertDefaultAssignmentOptions(const std::string& deviceName, const std::string& optionsTopic, OptionsCont& oc);
138 
139 
146  static bool equippedByDefaultAssignmentOptions(const OptionsCont& oc, const std::string& deviceName, SUMOVehicle& v);
148 
149 
150 
151 protected:
154 
155 
156 
157 private:
159  static std::map<std::string, std::set<std::string> > myExplicitIDs;
160 
161 
162 private:
164  MSDevice(const MSDevice&);
165 
167  MSDevice& operator=(const MSDevice&);
168 
169 };
170 
171 
172 #endif
173 
174 /****************************************************************************/
175 
virtual ~MSDevice()
Destructor.
Definition: MSDevice.h:98
SUMOVehicle & myHolder
The vehicle that stores the device.
Definition: MSDevice.h:153
static std::map< std::string, std::set< std::string > > myExplicitIDs
vehicles which explicitly carry a device, sorted by device, first
Definition: MSDevice.h:159
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
Definition: MSDevice.h:105
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice.cpp:73
Representation of a vehicle.
Definition: SUMOVehicle.h:65
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:86
Something on a lane to be noticed about vehicle movement.
Base class for objects which have an id.
Definition: Named.h:45
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:100
A storage for options typed value containers)
Definition: OptionsCont.h:108
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:92
virtual void generateOutput() const
Called on writing tripinfo output.
Definition: MSDevice.h:122