SUMO - Simulation of Urban MObility
SUMOVehicleClass.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Definitions of SUMO vehicle classes and helper functions
20 /****************************************************************************/
21 #ifndef SUMOVehicleClass_h
22 #define SUMOVehicleClass_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <string>
31 #include <set>
32 #include <limits>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class OutputDevice;
42 class SUMOSAXAttributes;
43 
44 // ===========================================================================
45 // enum definitions
46 // ===========================================================================
108 };
109 
110 
111 
135 
137 
138 
142  SVC_EMERGENCY = 1 << 1,
144  SVC_AUTHORITY = 1 << 2,
146  SVC_ARMY = 1 << 3,
148  SVC_VIP = 1 << 4,
150 
151 
153 
154 
156  SVC_PASSENGER = 1 << 5,
158  SVC_HOV = 1 << 6,
160  SVC_TAXI = 1 << 7,
162  SVC_BUS = 1 << 8,
164  SVC_COACH = 1 << 9,
166  SVC_DELIVERY = 1 << 10,
168  SVC_TRUCK = 1 << 11,
170  SVC_TRAILER = 1 << 12,
172  SVC_TRAM = 1 << 13,
174  SVC_RAIL_URBAN = 1 << 14,
176  SVC_RAIL = 1 << 15,
178  SVC_RAIL_ELECTRIC = 1 << 16,
179 
181  SVC_MOTORCYCLE = 1 << 17,
183  SVC_MOPED = 1 << 18,
185  SVC_BICYCLE = 1 << 19,
187  SVC_PEDESTRIAN = 1 << 20,
189  SVC_E_VEHICLE = 1 << 21,
191  SVC_SHIP = 1 << 22,
193  SVC_CUSTOM1 = 1 << 23,
195  SVC_CUSTOM2 = 1 << 24,
197 
202 };
203 
204 extern const int SUMOVehicleClass_MAX;
206 extern std::set<std::string> deprecatedVehicleClassesSeen;
208 
210 typedef int SVCPermissions;
211 
213 extern const SVCPermissions SVCAll;
214 
216 extern const SVCPermissions SVC_UNSPECIFIED;
217 
223 typedef int SUMOEmissionClass;
224 
225 
226 // ===========================================================================
227 // method declarations
228 // ===========================================================================
229 
230 // ---------------------------------------------------------------------------
231 // abstract vehicle class / purpose
232 // ---------------------------------------------------------------------------
238 extern std::string getVehicleClassNames(SVCPermissions permissions, bool expand = false);
239 
244 extern std::vector<std::string> getVehicleClassNamesList(SVCPermissions permissions);
245 
251 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
252 
257 extern int getVehicleClassCompoundID(const std::string& name);
258 
266 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
267 
269 extern bool canParseVehicleClasses(const std::string& classes);
270 
275 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS);
276 
281 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
282 
285 
287 extern void writePermissions(OutputDevice& into, SVCPermissions permissions);
288 
290 extern void writePreferences(OutputDevice& into, SVCPermissions preferred);
291 
293 extern std::map<SVCPermissions, double> parseStopOffsets(const SUMOSAXAttributes& attrs, bool& ok);
294 
295 // ---------------------------------------------------------------------------
296 // vehicle shape class
297 // ---------------------------------------------------------------------------
302 extern std::string getVehicleShapeName(SUMOVehicleShape id);
303 
308 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
309 
311 extern bool canParseVehicleShape(const std::string& shape);
312 
317 extern bool isRailway(SVCPermissions permissions);
318 
323 extern bool isWaterway(SVCPermissions permissions);
324 
329 extern bool isForbidden(SVCPermissions permissions);
330 
335 extern bool isSidewalk(SVCPermissions permissions);
336 
341 extern bool noVehicles(SVCPermissions permissions);
342 
343 // ---------------------------------------------------------------------------
344 // default vehicle type parameter
345 // ---------------------------------------------------------------------------
346 extern const std::string DEFAULT_VTYPE_ID;
347 extern const std::string DEFAULT_PEDTYPE_ID;
348 extern const std::string DEFAULT_BIKETYPE_ID;
349 
350 extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
351 
352 extern const double DEFAULT_PEDESTRIAN_SPEED;
353 
354 extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
355 
356 #endif
357 
358 /****************************************************************************/
359 
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
vehicle is a motorcycle
vehicle is a coach
render as a rail
int getVehicleClassCompoundID(const std::string &name)
Returns the OR&#39;ed id of the compound class given by its name.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
is a pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
bool noVehicles(SVCPermissions permissions)
Returns whether an edge with the given permission forbids vehicles.
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
const int SUMOVehicleClass_MAX
render as a transport vehicle
vehicle is a bicycle
render as a flexible city bus
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
vehicle is a small delivery vehicle
classes which (normally) do not drive on normal roads
vehicle is a light rail
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
render as a delivery vehicle
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
const std::string DEFAULT_BIKETYPE_ID
render as a sedan passenger vehicle ("Stufenheck")
const double DEFAULT_VEH_PROB
vehicle is a HOV
const std::string DEFAULT_VTYPE_ID
std::string getVehicleClassNames(SVCPermissions permissions, bool expand=false)
Returns the ids of the given classes, divided using a &#39; &#39;.
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
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
bool canParseVehicleShape(const std::string &shape)
Checks whether the given string contains only known vehicle shape.
render as a hatchback passenger vehicle ("Fliessheck")
Encapsulated SAX-Attributes.
render as a bus
army vehicles
classes which drive on tracks
const SVCPermissions SVCAll
all VClasses are allowed
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
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
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
render as a police car
vehicle is a passenger car (a "normal" car)
is an arbitrary ship
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
render as a fire brigade
vehicle is a taxi
vehicle is a bus
render as a giant ant
render as a pedestrian
render as a moped
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
const double DEFAULT_PEDESTRIAN_SPEED
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
render as a arbitrary ship
const std::string DEFAULT_PEDTYPE_ID
vip vehicles
std::map< SVCPermissions, double > parseStopOffsets(const SUMOSAXAttributes &attrs, bool &ok)
Extract stopOffsets from attributes of stopOffset element.
vehicle is a large transport vehicle
std::set< std::string > deprecatedVehicleClassesSeen
render as an emergency vehicle
render as a (futuristic) e-vehicle
std::vector< std::string > getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
render as a rickshaw
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool isSidewalk(SVCPermissions permissions)
Returns whether an edge with the given permission is a sidewalk.
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