Eclipse 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-2019 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 
29 #include <string>
30 #include <set>
31 #include <limits>
32 #include <utils/common/StdDefs.h>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class OutputDevice;
42 class SUMOSAXAttributes;
43 
44 // ===========================================================================
45 // enum definitions
46 // ===========================================================================
73  //SVS_PASSENGER_AUTOMATED,
110 };
111 
112 
113 
137 
139 
140 
144  SVC_EMERGENCY = 1 << 1,
146  SVC_AUTHORITY = 1 << 2,
148  SVC_ARMY = 1 << 3,
150  SVC_VIP = 1 << 4,
152 
153 
155 
156  SVC_PEDESTRIAN = 1 << 5,
158 
160  SVC_PASSENGER = 1 << 6,
162  SVC_HOV = 1 << 7,
164  SVC_TAXI = 1 << 8,
166  SVC_BUS = 1 << 9,
168  SVC_COACH = 1 << 10,
170  SVC_DELIVERY = 1 << 11,
172  SVC_TRUCK = 1 << 12,
174  SVC_TRAILER = 1 << 13,
176  SVC_MOTORCYCLE = 1 << 14,
178  SVC_MOPED = 1 << 15,
180  SVC_BICYCLE = 1 << 16,
182  SVC_E_VEHICLE = 1 << 17,
183 
185  SVC_TRAM = 1 << 18,
187  SVC_RAIL_URBAN = 1 << 19,
189  SVC_RAIL = 1 << 20,
191  SVC_RAIL_ELECTRIC = 1 << 21,
193  SVC_RAIL_FAST = 1 << 22,
194 
196  SVC_SHIP = 1 << 23,
197 
199  SVC_CUSTOM1 = 1 << 24,
201  SVC_CUSTOM2 = 1 << 25,
203 
211 };
212 
213 extern const int SUMOVehicleClass_MAX;
215 extern std::set<std::string> deprecatedVehicleClassesSeen;
217 
219 typedef int SVCPermissions;
220 
222 extern const SVCPermissions SVCAll;
223 
225 extern const SVCPermissions SVC_UNSPECIFIED;
226 
232 typedef int SUMOEmissionClass;
233 
234 
235 // ===========================================================================
236 // method declarations
237 // ===========================================================================
238 
239 // ---------------------------------------------------------------------------
240 // abstract vehicle class / purpose
241 // ---------------------------------------------------------------------------
247 extern const std::string& getVehicleClassNames(SVCPermissions permissions, bool expand = false);
248 
253 extern const std::vector<std::string>& getVehicleClassNamesList(SVCPermissions permissions);
254 
260 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
261 
266 extern int getVehicleClassCompoundID(const std::string& name);
267 
275 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
276 
278 extern bool canParseVehicleClasses(const std::string& classes);
279 
284 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS, double networkVersion = NETWORK_VERSION);
285 
290 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
291 
294 
296 extern void writePermissions(OutputDevice& into, SVCPermissions permissions);
297 
299 extern void writePreferences(OutputDevice& into, SVCPermissions preferred);
300 
302 extern std::map<SVCPermissions, double> parseStopOffsets(const SUMOSAXAttributes& attrs, bool& ok);
303 
304 // ---------------------------------------------------------------------------
305 // vehicle shape class
306 // ---------------------------------------------------------------------------
311 extern std::string getVehicleShapeName(SUMOVehicleShape id);
312 
317 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
318 
320 extern bool canParseVehicleShape(const std::string& shape);
321 
326 extern bool isRailway(SVCPermissions permissions);
327 
332 extern bool isWaterway(SVCPermissions permissions);
333 
338 extern bool isForbidden(SVCPermissions permissions);
339 
344 extern bool isSidewalk(SVCPermissions permissions);
345 
350 extern bool noVehicles(SVCPermissions permissions);
351 
352 // ---------------------------------------------------------------------------
353 // default vehicle type parameter
354 // ---------------------------------------------------------------------------
355 extern const std::string DEFAULT_VTYPE_ID;
356 extern const std::string DEFAULT_PEDTYPE_ID;
357 extern const std::string DEFAULT_BIKETYPE_ID;
358 
359 extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
360 
361 extern const double DEFAULT_PEDESTRIAN_SPEED;
362 
363 extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
364 
365 #endif
366 
367 /****************************************************************************/
368 
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
vehicle is a motorcycle
vehicle is a coach
render as a rail
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
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;
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.
automated car (with cruise controllers)
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
rail vehicle that requires electrified tracks
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 std::string & getVehicleClassNames(SVCPermissions permissions, bool expand=false)
Returns the ids of the given classes, divided using a &#39; &#39;.
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
classes which drive on roads
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
const double NETWORK_VERSION
version for written networks and default version for loading
Definition: StdDefs.h:66
render as an emergency vehicle
render as a (futuristic) e-vehicle
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")
vehicle that is allowed to drive on high-speed rail tracks
vehicles ignoring classes
render as a trolley bus
is a user-defined type
is an electric vehicle