Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
libtraci/VehicleType.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2017-2023 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
30namespace libtraci {
31
32typedef Domain<libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::CMD_SET_VEHICLETYPE_VARIABLE> Dom;
33
34
35// ===========================================================================
36// static member definitions
37// ===========================================================================
38std::vector<std::string>
39VehicleType::getIDList() {
41}
42
43
44int
45VehicleType::getIDCount() {
47}
48
49
52
53
54void
55VehicleType::copy(const std::string& origTypeID, const std::string& newTypeID) {
56 Dom::setString(libsumo::COPY, origTypeID, newTypeID);
57}
58
59double
60VehicleType::getSpeedFactor(const std::string& typeID) {
62}
63
64double
65VehicleType::getSpeedDeviation(const std::string& typeID) {
67}
68
69
70std::string
71VehicleType::getEmissionClass(const std::string& typeID) {
73}
74
75std::string
76VehicleType::getShapeClass(const std::string& typeID) {
78}
79
80
81double
82VehicleType::getLength(const std::string& typeID) {
83 return Dom::getDouble(libsumo::VAR_LENGTH, typeID);
84}
85
86
87double
88VehicleType::getAccel(const std::string& typeID) {
89 return Dom::getDouble(libsumo::VAR_ACCEL, typeID);
90}
91
92
93double
94VehicleType::getDecel(const std::string& typeID) {
95 return Dom::getDouble(libsumo::VAR_DECEL, typeID);
96}
97
98
99double VehicleType::getEmergencyDecel(const std::string& typeID) {
101}
102
103
104double VehicleType::getApparentDecel(const std::string& typeID) {
106}
107
108
109double VehicleType::getActionStepLength(const std::string& typeID) {
111}
112
113
114double
115VehicleType::getTau(const std::string& typeID) {
116 return Dom::getDouble(libsumo::VAR_TAU, typeID);
117}
118
119
120double
121VehicleType::getImperfection(const std::string& typeID) {
123}
124
125
126std::string
127VehicleType::getVehicleClass(const std::string& typeID) {
129}
130
131
132double
133VehicleType::getMinGap(const std::string& typeID) {
134 return Dom::getDouble(libsumo::VAR_MINGAP, typeID);
135}
136
137
138double
139VehicleType::getMinGapLat(const std::string& typeID) {
141}
142
143
144double
145VehicleType::getMaxSpeed(const std::string& typeID) {
147}
148
149
150double
151VehicleType::getMaxSpeedLat(const std::string& typeID) {
153}
154
155
156std::string
157VehicleType::getLateralAlignment(const std::string& typeID) {
159}
160
161
162double
163VehicleType::getWidth(const std::string& typeID) {
164 return Dom::getDouble(libsumo::VAR_WIDTH, typeID);
165}
166
167
168double
169VehicleType::getHeight(const std::string& typeID) {
170 return Dom::getDouble(libsumo::VAR_HEIGHT, typeID);
171}
172
173
175VehicleType::getColor(const std::string& typeID) {
176 return Dom::getCol(libsumo::VAR_COLOR, typeID);
177}
178
179
180int
181VehicleType::getPersonCapacity(const std::string& typeID) {
183}
184
185
186double
187VehicleType::getScale(const std::string& typeID) {
188 return Dom::getDouble(libsumo::VAR_SCALE, typeID);
189}
190
191
192double
193VehicleType::getBoardingDuration(const std::string& typeID) {
195}
196
197
198double
199VehicleType::getImpatience(const std::string& typeID) {
201}
202
203
204void
205VehicleType::setImpatience(const std::string& typeID, double impatience) {
206 Dom::setDouble(libsumo::VAR_IMPATIENCE, typeID, impatience);
207}
208
209void
210VehicleType::setBoardingDuration(const std::string& typeID, double boardingDuration) {
211 Dom::setDouble(libsumo::VAR_BOARDING_DURATION, typeID, boardingDuration);
212}
213
214void
215VehicleType::setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset) {
216 //if (actionStepLength < 0) {
217 // raise TraCIException("Invalid value for actionStepLength. Given value must be non-negative.")
218 //{
219 // Use negative value to indicate resetActionOffset == False
220 if (!resetActionOffset) {
221 actionStepLength *= -1;
222 }
223 Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, typeID, actionStepLength);
224}
225
226
227void
228VehicleType::setColor(const std::string& typeID, const libsumo::TraCIColor& col) {
229 Dom::setCol(libsumo::VAR_COLOR, typeID, col);
230}
231
232
233void
234VehicleType::setSpeedFactor(const std::string& typeID, double factor) {
236}
237
238
239void
240VehicleType::setSpeedDeviation(const std::string& typeID, double deviation) {
242}
243
244
245void
246VehicleType::setLength(const std::string& typeID, double length) {
247 Dom::setDouble(libsumo::VAR_LENGTH, typeID, length);
248}
249
250
251void
252VehicleType::setMaxSpeed(const std::string& typeID, double speed) {
254}
255
256
257void
258VehicleType::setVehicleClass(const std::string& typeID, const std::string& clazz) {
260}
261
262
263void
264VehicleType::setShapeClass(const std::string& typeID, const std::string& clazz) {
266}
267
268
269void
270VehicleType::setEmissionClass(const std::string& typeID, const std::string& clazz) {
272}
273
274
275void
276VehicleType::setWidth(const std::string& typeID, double width) {
277 Dom::setDouble(libsumo::VAR_WIDTH, typeID, width);
278}
279
280
281void
282VehicleType::setHeight(const std::string& typeID, double height) {
283 Dom::setDouble(libsumo::VAR_HEIGHT, typeID, height);
284}
285
286
287void
288VehicleType::setMinGap(const std::string& typeID, double minGap) {
289 Dom::setDouble(libsumo::VAR_MINGAP, typeID, minGap);
290}
291
292
293void
294VehicleType::setAccel(const std::string& typeID, double accel) {
295 Dom::setDouble(libsumo::VAR_ACCEL, typeID, accel);
296}
297
298
299void
300VehicleType::setDecel(const std::string& typeID, double decel) {
301 Dom::setDouble(libsumo::VAR_DECEL, typeID, decel);
302}
303
304
305void
306VehicleType::setEmergencyDecel(const std::string& typeID, double decel) {
308}
309
310
311void
312VehicleType::setApparentDecel(const std::string& typeID, double decel) {
314}
315
316
317void
318VehicleType::setImperfection(const std::string& typeID, double imperfection) {
319 Dom::setDouble(libsumo::VAR_IMPERFECTION, typeID, imperfection);
320}
321
322
323void
324VehicleType::setTau(const std::string& typeID, double tau) {
325 Dom::setDouble(libsumo::VAR_TAU, typeID, tau);
326}
327
328
329void
330VehicleType::setMinGapLat(const std::string& typeID, double minGapLat) {
331 Dom::setDouble(libsumo::VAR_MINGAP_LAT, typeID, minGapLat);
332}
333
334
335void
336VehicleType::setMaxSpeedLat(const std::string& typeID, double speed) {
338}
339
340
341void
342VehicleType::setLateralAlignment(const std::string& typeID, const std::string& latAlignment) {
343 Dom::setString(libsumo::VAR_LATALIGNMENT, typeID, latAlignment);
344}
345
346void
347VehicleType::setScale(const std::string& typeID, double value) {
348 Dom::setDouble(libsumo::VAR_SCALE, typeID, value);
349}
350
351}
352
353
354/****************************************************************************/
#define LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
Definition Domain.h:38
#define LIBTRACI_PARAMETER_IMPLEMENTATION(CLASS, DOMAIN)
Definition Domain.h:77
C++ TraCI client API implementation.
static void setDouble(int var, const std::string &id, double value)
Definition Domain.h:231
static void setCol(int var, const std::string &id, const libsumo::TraCIColor value)
Definition Domain.h:252
static std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition Domain.h:177
static libsumo::TraCIColor getCol(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition Domain.h:187
static std::string getString(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition Domain.h:172
static int getInt(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition Domain.h:125
static double getDouble(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition Domain.h:130
static void setString(int var, const std::string &id, const std::string &value)
Definition Domain.h:238
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_IMPATIENCE
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_SCALE
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_BOARDING_DURATION
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