SUMO - Simulation of Urban MObility
SUMOVehicleClass.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Definitions of SUMO vehicle classes and helper functions
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef SUMOVehicleClass_h
24 #define SUMOVehicleClass_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <set>
38 #include <limits>
42 
43 // ===========================================================================
44 // enum definitions
45 // ===========================================================================
97 };
98 
99 
100 
124 
126 
127 
131  SVC_EMERGENCY = 1 << 1,
133  SVC_AUTHORITY = 1 << 2,
135  SVC_ARMY = 1 << 3,
137  SVC_VIP = 1 << 4,
139 
140 
142 
143 
145  SVC_PASSENGER = 1 << 5,
147  SVC_HOV = 1 << 6,
149  SVC_TAXI = 1 << 7,
151  SVC_BUS = 1 << 8,
153  SVC_COACH = 1 << 9,
155  SVC_DELIVERY = 1 << 10,
157  SVC_TRUCK = 1 << 11,
159  SVC_TRAILER = 1 << 12,
161  SVC_TRAM = 1 << 13,
163  SVC_RAIL_URBAN = 1 << 14,
165  SVC_RAIL = 1 << 15,
167  SVC_RAIL_ELECTRIC = 1 << 16,
168 
170  SVC_MOTORCYCLE = 1 << 17,
172  SVC_MOPED = 1 << 18,
174  SVC_BICYCLE = 1 << 19,
176  SVC_PEDESTRIAN = 1 << 20,
178  SVC_E_VEHICLE = 1 << 21,
180  SVC_CUSTOM1 = 1 << 22,
182  SVC_CUSTOM2 = 1 << 23
184 };
185 
186 extern const int SUMOVehicleClass_MAX;
188 extern std::set<std::string> deprecatedVehicleClassesSeen;
190 
191 /* @brief bitset where each bit declares whether a certain SVC may use this edge/lane
192  */
193 typedef int SVCPermissions;
194 extern const SVCPermissions SVCAll;
195 
196 
202 typedef int SUMOEmissionClass;
203 
204 
205 // ===========================================================================
206 // method declarations
207 // ===========================================================================
208 
209 // ---------------------------------------------------------------------------
210 // abstract vehicle class / purpose
211 // ---------------------------------------------------------------------------
212 /* @brief SUMOVehicleClass is meant to be OR'ed to combine information about vehicle
213  * ownership and vehicle "size" into one int.
214  * These OR'ed values cannot be translated directly into strings with toString().
215  * The names of all base values are concatenated with '|' as a separator.
216  */
217 extern std::string getVehicleClassCompoundName(int id);
218 
219 
224 extern std::string getVehicleClassNames(SVCPermissions permissions);
225 
226 
231 extern std::vector<std::string> getVehicleClassNamesList(SVCPermissions permissions);
232 
233 
239 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
240 
245 extern int getVehicleClassCompoundID(const std::string& name);
246 
254 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
255 
256 
259 extern bool canParseVehicleClasses(const std::string& classes);
260 
265 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS);
266 
267 
272 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
273 
274 
275 // ---------------------------------------------------------------------------
276 // vehicle shape class
277 // ---------------------------------------------------------------------------
282 extern std::string getVehicleShapeName(SUMOVehicleShape id);
283 
284 
289 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
290 
291 
296 extern bool isRailway(SVCPermissions permissions);
297 
302 extern bool isForbidden(SVCPermissions permissions);
303 
304 // ---------------------------------------------------------------------------
305 // default vehicle type parameter
306 // ---------------------------------------------------------------------------
307 extern const std::string DEFAULT_VTYPE_ID;
308 
309 extern const SUMOReal DEFAULT_VEH_PROB; // !!! does this belong here?
310 
312 
313 #endif
314 
315 /****************************************************************************/
316 
std::string getVehicleClassCompoundName(int id)
vehicle is a motorcycle
vehicle is a coach
render as a rail
int getVehicleClassCompoundID(const std::string &name)
Returns the OR'ed id of the compound class given by its name.
is a pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
render as a motorcycle
vehicle is a not electrified rail
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
const int SUMOVehicleClass_MAX
render as a transport vehicle
vehicle is a bicycle
render as a flexible city bus
int SVCPermissions
vehicle is a small delivery vehicle
vehicle is a light rail
const SUMOReal DEFAULT_PEDESTRIAN_SPEED
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const SUMOReal DEFAULT_VEH_PROB
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
render as a delivery vehicle
render as a sedan passenger vehicle ("Stufenheck")
vehicle is a HOV
const std::string DEFAULT_VTYPE_ID
vehicle is a (possibly fast moving) electric rail
authorities vehicles
vehicle is a city rail
vehicle is a large transport vehicle
is a user-defined type
render as a hatchback passenger vehicle ("Fliessheck")
render as a bus
army vehicles
const SVCPermissions SVCAll
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings
private vehicles
int SUMOEmissionClass
not defined
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
render as a bicycle
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
render as a (city) rail without locomotive
render as a van
render as a passenger vehicle
vehicle is a passenger car (a "normal" car)
vehicle is a moped
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
render as a cargo train
vehicle is a taxi
vehicle is a bus
render as a giant ant
render as a pedestrian
render as a moped
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
vip vehicles
vehicle is a large transport vehicle
std::set< std::string > deprecatedVehicleClassesSeen
render as a (futuristic) e-vehicle
std::vector< std::string > getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
#define SUMOReal
Definition: config.h:215
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings
public emergency vehicles
render as a transport vehicle with one trailer
render as a wagon passenger vehicle ("Combi")
render as a coach
render as a semi-trailer transport vehicle ("Sattelschlepper")
vehicles ignoring classes
render as a trolley bus
is a user-defined type
is an electric vehicle