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-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 /****************************************************************************/
22 // Definitions of SUMO vehicle classes and helper functions
23 /****************************************************************************/
24 #pragma once
25 #include <string>
26 #include <set>
27 #include <limits>
28 #include <utils/common/StdDefs.h>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class OutputDevice;
38 class SUMOSAXAttributes;
39 
40 // ===========================================================================
41 // enum definitions
42 // ===========================================================================
69  //SVS_PASSENGER_AUTOMATED,
106 };
107 
108 
109 
133 
135 
136 
140  SVC_EMERGENCY = 1 << 1,
142  SVC_AUTHORITY = 1 << 2,
144  SVC_ARMY = 1 << 3,
146  SVC_VIP = 1 << 4,
148 
149 
151 
152  SVC_PEDESTRIAN = 1 << 5,
154 
156  SVC_PASSENGER = 1 << 6,
158  SVC_HOV = 1 << 7,
160  SVC_TAXI = 1 << 8,
162  SVC_BUS = 1 << 9,
164  SVC_COACH = 1 << 10,
166  SVC_DELIVERY = 1 << 11,
168  SVC_TRUCK = 1 << 12,
170  SVC_TRAILER = 1 << 13,
172  SVC_MOTORCYCLE = 1 << 14,
174  SVC_MOPED = 1 << 15,
176  SVC_BICYCLE = 1 << 16,
178  SVC_E_VEHICLE = 1 << 17,
179 
181  SVC_TRAM = 1 << 18,
183  SVC_RAIL_URBAN = 1 << 19,
185  SVC_RAIL = 1 << 20,
187  SVC_RAIL_ELECTRIC = 1 << 21,
189  SVC_RAIL_FAST = 1 << 22,
190 
192  SVC_SHIP = 1 << 23,
193 
195  SVC_CUSTOM1 = 1 << 24,
197  SVC_CUSTOM2 = 1 << 25,
199 
207 };
208 
211 extern std::set<std::string> deprecatedVehicleClassesSeen;
213 
215 typedef int SVCPermissions;
216 
218 extern const SVCPermissions SVCAll;
219 
221 extern const SVCPermissions SVC_UNSPECIFIED;
222 
228 typedef int SUMOEmissionClass;
229 
230 
231 // ===========================================================================
232 // method declarations
233 // ===========================================================================
234 
235 // ---------------------------------------------------------------------------
236 // abstract vehicle class / purpose
237 // ---------------------------------------------------------------------------
243 extern const std::string& getVehicleClassNames(SVCPermissions permissions, bool expand = false);
244 
249 extern const std::vector<std::string>& getVehicleClassNamesList(SVCPermissions permissions);
250 
256 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
257 
262 extern int getVehicleClassCompoundID(const std::string& name);
263 
271 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
272 
274 extern bool canParseVehicleClasses(const std::string& classes);
275 
280 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS, double networkVersion = NETWORK_VERSION);
281 
286 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
287 
290 
292 extern void writePermissions(OutputDevice& into, SVCPermissions permissions);
293 
295 extern void writePreferences(OutputDevice& into, SVCPermissions preferred);
296 
298 extern std::map<SVCPermissions, double> parseStopOffsets(const SUMOSAXAttributes& attrs, bool& ok);
299 
300 // ---------------------------------------------------------------------------
301 // vehicle shape class
302 // ---------------------------------------------------------------------------
307 extern std::string getVehicleShapeName(SUMOVehicleShape id);
308 
313 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
314 
316 extern bool canParseVehicleShape(const std::string& shape);
317 
322 extern bool isRailway(SVCPermissions permissions);
323 
328 extern bool isWaterway(SVCPermissions permissions);
329 
334 extern bool isForbidden(SVCPermissions permissions);
335 
340 extern bool isSidewalk(SVCPermissions permissions);
341 
346 extern bool noVehicles(SVCPermissions permissions);
347 
353 extern double getDefaultVehicleLength(const SUMOVehicleClass vc = SVC_IGNORING);
354 
355 // ---------------------------------------------------------------------------
356 // default vehicle type parameter
357 // ---------------------------------------------------------------------------
358 extern const std::string DEFAULT_VTYPE_ID;
359 extern const std::string DEFAULT_PEDTYPE_ID;
360 extern const std::string DEFAULT_BIKETYPE_ID;
361 extern const std::string DEFAULT_CONTAINERTYPE_ID;
362 extern const std::string DEFAULT_TAXITYPE_ID;
363 
364 extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
365 
366 extern const double DEFAULT_PEDESTRIAN_SPEED;
367 
368 extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand=false)
Returns the ids of the given classes, divided using a ' '.
bool canParseVehicleShape(const std::string &shape)
Checks whether the given string contains only known vehicle shape.
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const SVCPermissions SVCAll
all VClasses are allowed
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_VIP
vip vehicles
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_ROAD_CLASSES
classes which drive on roads
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_CUSTOM2
is a user-defined type
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_COACH
vehicle is a coach
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_CUSTOM1
is a user-defined type
@ SVC_ARMY
army vehicles
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_NON_ROAD
classes which (normally) do not drive on normal roads
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_MOPED
vehicle is a moped
@ SVC_AUTHORITY
authorities vehicles
@ SVC_TRAM
vehicle is a light rail
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_E_VEHICLE
is an electric vehicle
@ SVC_PEDESTRIAN
pedestrian
int SUMOEmissionClass
std::set< std::string > deprecatedVehicleClassesSeen
const std::string DEFAULT_TAXITYPE_ID
const double DEFAULT_VEH_PROB
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
double getDefaultVehicleLength(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default vehicle length This put into a function so it can be used by NBVehicle.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
int getVehicleClassCompoundID(const std::string &name)
Returns the OR'ed id of the compound class given by its name.
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
const std::string DEFAULT_PEDTYPE_ID
std::map< SVCPermissions, double > parseStopOffsets(const SUMOSAXAttributes &attrs, bool &ok)
Extract stopOffsets from attributes of stopOffset element.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
@ SVS_BICYCLE
render as a bicycle
@ SVS_FIREBRIGADE
render as a fire brigade
@ SVS_ANT
render as a giant ant
@ SVS_PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ SVS_TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ SVS_RAIL
render as a rail
@ SVS_EMERGENCY
render as an emergency vehicle
@ SVS_DELIVERY
automated car (with cruise controllers)
@ SVS_MOTORCYCLE
render as a motorcycle
@ SVS_UNKNOWN
not defined
@ SVS_PASSENGER
render as a passenger vehicle
@ SVS_TRUCK
render as a transport vehicle
@ SVS_PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ SVS_BUS
render as a bus
@ SVS_MOPED
render as a moped
@ SVS_E_VEHICLE
render as a (futuristic) e-vehicle
@ SVS_BUS_FLEXIBLE
render as a flexible city bus
@ SVS_BUS_TROLLEY
render as a trolley bus
@ SVS_RAIL_CARGO
render as a cargo train
@ SVS_BUS_COACH
render as a coach
@ SVS_SHIP
render as a arbitrary ship
@ SVS_RAIL_CAR
render as a (city) rail without locomotive
@ SVS_PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ SVS_PASSENGER_VAN
render as a van
@ SVS_PEDESTRIAN
render as a pedestrian
@ SVS_POLICE
render as a police car
@ SVS_RICKSHAW
render as a rickshaw
@ SVS_TRUCK_1TRAILER
render as a transport vehicle with one trailer
const double DEFAULT_PEDESTRIAN_SPEED
bool isSidewalk(SVCPermissions permissions)
Returns whether an edge with the given permission is a sidewalk.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
bool noVehicles(SVCPermissions permissions)
Returns whether an edge with the given permission forbids vehicles.
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_CONTAINERTYPE_ID
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
const SUMOVehicleClass SUMOVehicleClass_MAX
const std::string DEFAULT_BIKETYPE_ID
const double NETWORK_VERSION
version for written networks and default version for loading
Definition: StdDefs.h:65
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
Encapsulated SAX-Attributes.