Eclipse SUMO - Simulation of Urban MObility
libtraci/VehicleType.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2017-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // C++ TraCI client API implementation
20 /****************************************************************************/
21 #include <config.h>
22 #include <sstream>
23 
24 #define LIBTRACI 1
25 #include <libsumo/VehicleType.h>
26 #include "Connection.h"
27 #include "Domain.h"
28 
29 
30 namespace libtraci {
31 
32 typedef Domain<libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::CMD_SET_VEHICLETYPE_VARIABLE> Dom;
33 
34 
35 // ===========================================================================
36 // static member definitions
37 // ===========================================================================
38 std::vector<std::string>
39 VehicleType::getIDList() {
41 }
42 
43 
44 int
45 VehicleType::getIDCount() {
46  return Dom::getInt(libsumo::ID_COUNT, "");
47 }
48 
49 
52 
53 
54 void
55 VehicleType::copy(const std::string& origTypeID, const std::string& newTypeID) {
56  Dom::setString(libsumo::COPY, origTypeID, newTypeID);
57 }
58 
59 double
60 VehicleType::getSpeedFactor(const std::string& typeID) {
62 }
63 
64 double
65 VehicleType::getSpeedDeviation(const std::string& typeID) {
67 }
68 
69 
70 std::string
71 VehicleType::getEmissionClass(const std::string& typeID) {
73 }
74 
75 std::string
76 VehicleType::getShapeClass(const std::string& typeID) {
78 }
79 
80 
81 double
82 VehicleType::getLength(const std::string& typeID) {
83  return Dom::getDouble(libsumo::VAR_LENGTH, typeID);
84 }
85 
86 
87 double
88 VehicleType::getAccel(const std::string& typeID) {
89  return Dom::getDouble(libsumo::VAR_ACCEL, typeID);
90 }
91 
92 
93 double
94 VehicleType::getDecel(const std::string& typeID) {
95  return Dom::getDouble(libsumo::VAR_DECEL, typeID);
96 }
97 
98 
99 double VehicleType::getEmergencyDecel(const std::string& typeID) {
101 }
102 
103 
104 double VehicleType::getApparentDecel(const std::string& typeID) {
106 }
107 
108 
109 double VehicleType::getActionStepLength(const std::string& typeID) {
111 }
112 
113 
114 double
115 VehicleType::getTau(const std::string& typeID) {
116  return Dom::getDouble(libsumo::VAR_TAU, typeID);
117 }
118 
119 
120 double
121 VehicleType::getImperfection(const std::string& typeID) {
123 }
124 
125 
126 std::string
127 VehicleType::getVehicleClass(const std::string& typeID) {
129 }
130 
131 
132 double
133 VehicleType::getMinGap(const std::string& typeID) {
134  return Dom::getDouble(libsumo::VAR_MINGAP, typeID);
135 }
136 
137 
138 double
139 VehicleType::getMinGapLat(const std::string& typeID) {
140  return Dom::getDouble(libsumo::VAR_MINGAP_LAT, typeID);
141 }
142 
143 
144 double
145 VehicleType::getMaxSpeed(const std::string& typeID) {
146  return Dom::getDouble(libsumo::VAR_MAXSPEED, typeID);
147 }
148 
149 
150 double
151 VehicleType::getMaxSpeedLat(const std::string& typeID) {
153 }
154 
155 
156 std::string
157 VehicleType::getLateralAlignment(const std::string& typeID) {
159 }
160 
161 
162 double
163 VehicleType::getWidth(const std::string& typeID) {
164  return Dom::getDouble(libsumo::VAR_WIDTH, typeID);
165 }
166 
167 
168 double
169 VehicleType::getHeight(const std::string& typeID) {
170  return Dom::getDouble(libsumo::VAR_HEIGHT, typeID);
171 }
172 
173 
175 VehicleType::getColor(const std::string& typeID) {
176  return Dom::getCol(libsumo::VAR_COLOR, typeID);
177 }
178 
179 
180 int
181 VehicleType::getPersonCapacity(const std::string& typeID) {
183 }
184 
185 
186 void
187 VehicleType::setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset) {
188  //if (actionStepLength < 0) {
189  // raise TraCIException("Invalid value for actionStepLength. Given value must be non-negative.")
190  //{
191  // Use negative value to indicate resetActionOffset == False
192  if (!resetActionOffset) {
193  actionStepLength *= -1;
194  }
195  Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, typeID, actionStepLength);
196 }
197 
198 
199 void
200 VehicleType::setColor(const std::string& typeID, const libsumo::TraCIColor& col) {
201  Dom::setCol(libsumo::VAR_COLOR, typeID, col);
202 }
203 
204 
205 void
206 VehicleType::setSpeedFactor(const std::string& typeID, double factor) {
207  Dom::setDouble(libsumo::VAR_SPEED_FACTOR, typeID, factor);
208 }
209 
210 
211 void
212 VehicleType::setSpeedDeviation(const std::string& typeID, double deviation) {
213  Dom::setDouble(libsumo::VAR_SPEED_DEVIATION, typeID, deviation);
214 }
215 
216 
217 void
218 VehicleType::setLength(const std::string& typeID, double length) {
219  Dom::setDouble(libsumo::VAR_LENGTH, typeID, length);
220 }
221 
222 
223 void
224 VehicleType::setMaxSpeed(const std::string& typeID, double speed) {
225  Dom::setDouble(libsumo::VAR_MAXSPEED, typeID, speed);
226 }
227 
228 
229 void
230 VehicleType::setVehicleClass(const std::string& typeID, const std::string& clazz) {
232 }
233 
234 
235 void
236 VehicleType::setShapeClass(const std::string& typeID, const std::string& clazz) {
237  Dom::setString(libsumo::VAR_SHAPECLASS, typeID, clazz);
238 }
239 
240 
241 void
242 VehicleType::setEmissionClass(const std::string& typeID, const std::string& clazz) {
244 }
245 
246 
247 void
248 VehicleType::setWidth(const std::string& typeID, double width) {
249  Dom::setDouble(libsumo::VAR_WIDTH, typeID, width);
250 }
251 
252 
253 void
254 VehicleType::setHeight(const std::string& typeID, double height) {
255  Dom::setDouble(libsumo::VAR_HEIGHT, typeID, height);
256 }
257 
258 
259 void
260 VehicleType::setMinGap(const std::string& typeID, double minGap) {
261  Dom::setDouble(libsumo::VAR_MINGAP, typeID, minGap);
262 }
263 
264 
265 void
266 VehicleType::setAccel(const std::string& typeID, double accel) {
267  Dom::setDouble(libsumo::VAR_ACCEL, typeID, accel);
268 }
269 
270 
271 void
272 VehicleType::setDecel(const std::string& typeID, double decel) {
273  Dom::setDouble(libsumo::VAR_DECEL, typeID, decel);
274 }
275 
276 
277 void
278 VehicleType::setEmergencyDecel(const std::string& typeID, double decel) {
280 }
281 
282 
283 void
284 VehicleType::setApparentDecel(const std::string& typeID, double decel) {
286 }
287 
288 
289 void
290 VehicleType::setImperfection(const std::string& typeID, double imperfection) {
291  Dom::setDouble(libsumo::VAR_IMPERFECTION, typeID, imperfection);
292 }
293 
294 
295 void
296 VehicleType::setTau(const std::string& typeID, double tau) {
297  Dom::setDouble(libsumo::VAR_TAU, typeID, tau);
298 }
299 
300 
301 void
302 VehicleType::setMinGapLat(const std::string& typeID, double minGapLat) {
303  Dom::setDouble(libsumo::VAR_MINGAP_LAT, typeID, minGapLat);
304 }
305 
306 
307 void
308 VehicleType::setMaxSpeedLat(const std::string& typeID, double speed) {
310 }
311 
312 
313 void
314 VehicleType::setLateralAlignment(const std::string& typeID, const std::string& latAlignment) {
315  Dom::setString(libsumo::VAR_LATALIGNMENT, typeID, latAlignment);
316 }
317 
318 }
319 
320 
321 /****************************************************************************/
#define LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
Definition: Domain.h:36
#define LIBTRACI_PARAMETER_IMPLEMENTATION(CLASS, DOMAIN)
Definition: Domain.h:74
C++ TraCI client API implementation.
static void setDouble(int var, const std::string &id, double value)
Definition: Domain.h:156
static void setCol(int var, const std::string &id, const libsumo::TraCIColor value)
Definition: Domain.h:168
static std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:140
static libsumo::TraCIColor getCol(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:144
static std::string getString(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:136
static int getInt(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:116
static double getDouble(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:120
static void setString(int var, const std::string &id, const std::string &value)
Definition: Domain.h:160
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_MINGAP
TRACI_CONST int VAR_SHAPECLASS
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int VAR_TAU
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_PERSON_CAPACITY
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int COPY
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_MAXSPEED_LAT
TRACI_CONST int ID_COUNT
TRACI_CONST int VAR_IMPERFECTION
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_APPARENT_DECEL
TRACI_CONST int VAR_DECEL
TRACI_CONST int VAR_MINGAP_LAT
TRACI_CONST int VAR_EMERGENCY_DECEL
TRACI_CONST int VAR_EMISSIONCLASS
TRACI_CONST int VAR_ACCEL
TRACI_CONST int VAR_SPEED_DEVIATION
Domain< libsumo::CMD_GET_BUSSTOP_VARIABLE, libsumo::CMD_SET_BUSSTOP_VARIABLE > Dom