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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
21 // Definitions of SUMO vehicle classes and helper functions
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 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class OutputDevice;
48 
49 
50 // ===========================================================================
51 // enum definitions
52 // ===========================================================================
112 };
113 
114 
115 
139 
141 
142 
146  SVC_EMERGENCY = 1 << 1,
148  SVC_AUTHORITY = 1 << 2,
150  SVC_ARMY = 1 << 3,
152  SVC_VIP = 1 << 4,
154 
155 
157 
158 
160  SVC_PASSENGER = 1 << 5,
162  SVC_HOV = 1 << 6,
164  SVC_TAXI = 1 << 7,
166  SVC_BUS = 1 << 8,
168  SVC_COACH = 1 << 9,
170  SVC_DELIVERY = 1 << 10,
172  SVC_TRUCK = 1 << 11,
174  SVC_TRAILER = 1 << 12,
176  SVC_TRAM = 1 << 13,
178  SVC_RAIL_URBAN = 1 << 14,
180  SVC_RAIL = 1 << 15,
182  SVC_RAIL_ELECTRIC = 1 << 16,
183 
185  SVC_MOTORCYCLE = 1 << 17,
187  SVC_MOPED = 1 << 18,
189  SVC_BICYCLE = 1 << 19,
191  SVC_PEDESTRIAN = 1 << 20,
193  SVC_E_VEHICLE = 1 << 21,
195  SVC_SHIP = 1 << 22,
197  SVC_CUSTOM1 = 1 << 23,
199  SVC_CUSTOM2 = 1 << 24,
201 
204 };
205 
206 extern const int SUMOVehicleClass_MAX;
208 extern std::set<std::string> deprecatedVehicleClassesSeen;
210 
212 typedef int SVCPermissions;
213 
215 extern const SVCPermissions SVCAll;
216 
218 extern const SVCPermissions SVC_UNSPECIFIED;
219 
225 typedef int SUMOEmissionClass;
226 
227 
228 // ===========================================================================
229 // method declarations
230 // ===========================================================================
231 
232 // ---------------------------------------------------------------------------
233 // abstract vehicle class / purpose
234 // ---------------------------------------------------------------------------
240 extern std::string getVehicleClassNames(SVCPermissions permissions, bool expand = false);
241 
246 extern std::vector<std::string> getVehicleClassNamesList(SVCPermissions permissions);
247 
253 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
254 
259 extern int getVehicleClassCompoundID(const std::string& name);
260 
268 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
269 
271 extern bool canParseVehicleClasses(const std::string& classes);
272 
277 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS);
278 
283 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
284 
287 
289 extern void writePermissions(OutputDevice& into, SVCPermissions permissions);
290 
292 extern void writePreferences(OutputDevice& into, SVCPermissions preferred);
293 
294 // ---------------------------------------------------------------------------
295 // vehicle shape class
296 // ---------------------------------------------------------------------------
301 extern std::string getVehicleShapeName(SUMOVehicleShape id);
302 
307 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
308 
310 extern bool canParseVehicleShape(const std::string& shape);
311 
316 extern bool isRailway(SVCPermissions permissions);
317 
322 extern bool isWaterway(SVCPermissions permissions);
323 
328 extern bool isForbidden(SVCPermissions permissions);
329 
330 // ---------------------------------------------------------------------------
331 // default vehicle type parameter
332 // ---------------------------------------------------------------------------
333 extern const std::string DEFAULT_VTYPE_ID;
334 extern const std::string DEFAULT_PEDTYPE_ID;
335 
336 extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
337 
338 extern const double DEFAULT_PEDESTRIAN_SPEED;
339 
340 extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
341 
342 #endif
343 
344 /****************************************************************************/
345 
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...
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
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")
render as a bus
army vehicles
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
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;.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
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