SUMO - Simulation of Urban MObility
SUMOVehicleClass.h File Reference
#include <config.h>
#include <string>
#include <set>
#include <limits>
#include <utils/common/UtilExceptions.h>
#include <utils/common/StringBijection.h>
#include <utils/xml/SUMOXMLDefinitions.h>
Include dependency graph for SUMOVehicleClass.h:

Go to the source code of this file.

Typedefs

typedef int SUMOEmissionClass
 
typedef int SVCPermissions
 bitset where each bit declares whether a certain SVC may use this edge/lane More...
 

Enumerations

enum  SUMOVehicleClass {
  SVC_IGNORING = 0, SVC_PRIVATE = 1, SVC_EMERGENCY = 1 << 1, SVC_AUTHORITY = 1 << 2,
  SVC_ARMY = 1 << 3, SVC_VIP = 1 << 4, SVC_PASSENGER = 1 << 5, SVC_HOV = 1 << 6,
  SVC_TAXI = 1 << 7, SVC_BUS = 1 << 8, SVC_COACH = 1 << 9, SVC_DELIVERY = 1 << 10,
  SVC_TRUCK = 1 << 11, SVC_TRAILER = 1 << 12, SVC_TRAM = 1 << 13, SVC_RAIL_URBAN = 1 << 14,
  SVC_RAIL = 1 << 15, SVC_RAIL_ELECTRIC = 1 << 16, SVC_MOTORCYCLE = 1 << 17, SVC_MOPED = 1 << 18,
  SVC_BICYCLE = 1 << 19, SVC_PEDESTRIAN = 1 << 20, SVC_E_VEHICLE = 1 << 21, SVC_SHIP = 1 << 22,
  SVC_CUSTOM1 = 1 << 23, SVC_CUSTOM2 = 1 << 24, SVC_NON_ROAD = SVC_TRAM | SVC_RAIL | SVC_RAIL_URBAN | SVC_RAIL_ELECTRIC | SVC_SHIP
}
 Definition of vehicle classes to differ between different lane usage and authority types. More...
 
enum  SUMOVehicleShape {
  SVS_UNKNOWN, SVS_PEDESTRIAN, SVS_BICYCLE, SVS_MOPED,
  SVS_MOTORCYCLE, SVS_PASSENGER, SVS_PASSENGER_SEDAN, SVS_PASSENGER_HATCHBACK,
  SVS_PASSENGER_WAGON, SVS_PASSENGER_VAN, SVS_DELIVERY, SVS_TRUCK,
  SVS_TRUCK_SEMITRAILER, SVS_TRUCK_1TRAILER, SVS_BUS, SVS_BUS_COACH,
  SVS_BUS_FLEXIBLE, SVS_BUS_TROLLEY, SVS_RAIL, SVS_RAIL_CAR,
  SVS_RAIL_CARGO, SVS_E_VEHICLE, SVS_ANT, SVS_SHIP,
  SVS_EMERGENCY, SVS_FIREBRIGADE, SVS_POLICE
}
 Definition of vehicle classes to differ between different appearences. More...
 

Functions

bool canParseVehicleClasses (const std::string &classes)
 Checks whether the given string contains only known vehicle classes. More...
 
bool canParseVehicleShape (const std::string &shape)
 Checks whether the given string contains only known vehicle shape. More...
 
int getVehicleClassCompoundID (const std::string &name)
 Returns the OR'ed id of the compound class given by its name. More...
 
SUMOVehicleClass getVehicleClassID (const std::string &name)
 Returns the class id of the abstract class given by its name. More...
 
std::string getVehicleClassNames (SVCPermissions permissions, bool expand=false)
 Returns the ids of the given classes, divided using a ' '. More...
 
std::vector< std::string > getVehicleClassNamesList (SVCPermissions permissions)
 Returns the ids of the given classes, divided using a ' '. More...
 
SUMOVehicleShape getVehicleShapeID (const std::string &name)
 Returns the class id of the shape class given by its name. More...
 
std::string getVehicleShapeName (SUMOVehicleShape id)
 Returns the class name of the shape class given by its id. More...
 
bool isForbidden (SVCPermissions permissions)
 Returns whether an edge with the given permission is a forbidden edge. More...
 
bool isRailway (SVCPermissions permissions)
 Returns whether an edge with the given permission is a railway edge. More...
 
bool isWaterway (SVCPermissions permissions)
 Returns whether an edge with the given permission is a waterway edge. More...
 
SVCPermissions parseVehicleClasses (const std::string &allowedS)
 Parses the given definition of allowed vehicle classes into the given containers Deprecated classes go into a separate container. More...
 
SVCPermissions parseVehicleClasses (const std::string &allowedS, const std::string &disallowedS)
 Encodes the given vector of allowed and disallowed classes into a bitset. More...
 
SVCPermissions parseVehicleClasses (const std::vector< std::string > &allowedS)
 Encodes the given vector of allowed classs into a bitset Unlike the methods which parse a string it gives immediately a warning output on deprecated vehicle classes. More...
 
void writePermissions (OutputDevice &into, SVCPermissions permissions)
 writes allowed disallowed attributes if needed; More...
 
void writePreferences (OutputDevice &into, SVCPermissions preferred)
 writes allowed disallowed attributes if needed; More...
 

Variables

const double DEFAULT_CONTAINER_TRANSHIP_SPEED
 
const double DEFAULT_PEDESTRIAN_SPEED
 
const std::string DEFAULT_PEDTYPE_ID
 
const double DEFAULT_VEH_PROB
 
const std::string DEFAULT_VTYPE_ID
 
std::set< std::string > deprecatedVehicleClassesSeen
 
const int SUMOVehicleClass_MAX
 
StringBijection< SUMOVehicleClassSumoVehicleClassStrings
 
StringBijection< SUMOVehicleShapeSumoVehicleShapeStrings
 
const SVCPermissions SVC_UNSPECIFIED
 permissions not specified More...
 
const SVCPermissions SVCAll
 all VClasses are allowed More...
 

Detailed Description

Author
Daniel Krajzewicz
Jakob Erdmann
Michael Behrisch
Walter Bamberger
Laura Bieker
Date
2006-01-24
Version
Id
SUMOVehicleClass.h 24108 2017-04-27 18:43:30Z behrisch

Definition in file SUMOVehicleClass.h.

Typedef Documentation

◆ SUMOEmissionClass

typedef int SUMOEmissionClass

Definition at line 226 of file SUMOVehicleClass.h.

◆ SVCPermissions

typedef int SVCPermissions

bitset where each bit declares whether a certain SVC may use this edge/lane

Definition at line 213 of file SUMOVehicleClass.h.

Enumeration Type Documentation

◆ SUMOVehicleClass

Definition of vehicle classes to differ between different lane usage and authority types.

Bits:

  • 0-7: vehicle ownership
  • 8-23: vehicle size

From NavTeq:

  • [0] All
  • [1] Passenger cars
  • [2] High Occupancy Vehicle
  • [3] Emergency Vehicle
  • [4] Taxi
  • [5] Public Bus
  • [6] Delivery Truck
  • [7] Transport Truck
  • [8] Bicycle
  • [9] Pedestrian
Enumerator
SVC_IGNORING 

vehicles ignoring classes

SVC_PRIVATE 

private vehicles

SVC_EMERGENCY 

public emergency vehicles

SVC_AUTHORITY 

authorities vehicles

SVC_ARMY 

army vehicles

SVC_VIP 

vip vehicles

SVC_PASSENGER 

vehicle is a passenger car (a "normal" car)

SVC_HOV 

vehicle is a HOV

SVC_TAXI 

vehicle is a taxi

SVC_BUS 

vehicle is a bus

SVC_COACH 

vehicle is a coach

SVC_DELIVERY 

vehicle is a small delivery vehicle

SVC_TRUCK 

vehicle is a large transport vehicle

SVC_TRAILER 

vehicle is a large transport vehicle

SVC_TRAM 

vehicle is a light rail

SVC_RAIL_URBAN 

vehicle is a city rail

SVC_RAIL 

vehicle is a not electrified rail

SVC_RAIL_ELECTRIC 

vehicle is a (possibly fast moving) electric rail

SVC_MOTORCYCLE 

vehicle is a motorcycle

SVC_MOPED 

vehicle is a moped

SVC_BICYCLE 

vehicle is a bicycle

SVC_PEDESTRIAN 

is a pedestrian

SVC_E_VEHICLE 

is an electric vehicle

SVC_SHIP 

is an arbitrary ship

SVC_CUSTOM1 

is a user-defined type

SVC_CUSTOM2 

is a user-defined type

SVC_NON_ROAD 

classes which (normally) do not drive on normal roads

Definition at line 137 of file SUMOVehicleClass.h.

◆ SUMOVehicleShape

Definition of vehicle classes to differ between different appearences.

Enumerator
SVS_UNKNOWN 

not defined

SVS_PEDESTRIAN 

render as a pedestrian

SVS_BICYCLE 

render as a bicycle

SVS_MOPED 

render as a moped

SVS_MOTORCYCLE 

render as a motorcycle

SVS_PASSENGER 

render as a passenger vehicle

SVS_PASSENGER_SEDAN 

render as a sedan passenger vehicle ("Stufenheck")

SVS_PASSENGER_HATCHBACK 

render as a hatchback passenger vehicle ("Fliessheck")

SVS_PASSENGER_WAGON 

render as a wagon passenger vehicle ("Combi")

SVS_PASSENGER_VAN 

render as a van

SVS_DELIVERY 

render as a delivery vehicle

SVS_TRUCK 

render as a transport vehicle

SVS_TRUCK_SEMITRAILER 

render as a semi-trailer transport vehicle ("Sattelschlepper")

SVS_TRUCK_1TRAILER 

render as a transport vehicle with one trailer

SVS_BUS 

render as a bus

SVS_BUS_COACH 

render as a coach

SVS_BUS_FLEXIBLE 

render as a flexible city bus

SVS_BUS_TROLLEY 

render as a trolley bus

SVS_RAIL 

render as a rail

SVS_RAIL_CAR 

render as a (city) rail without locomotive

SVS_RAIL_CARGO 

render as a cargo train

SVS_E_VEHICLE 

render as a (futuristic) e-vehicle

SVS_ANT 

render as a giant ant

SVS_SHIP 

render as a arbitrary ship

SVS_EMERGENCY 

render as an emergency vehicle

SVS_FIREBRIGADE 

render as a fire brigade

SVS_POLICE 

render as a police car

Definition at line 58 of file SUMOVehicleClass.h.

Function Documentation

◆ canParseVehicleClasses()

bool canParseVehicleClasses ( const std::string &  classes)

◆ canParseVehicleShape()

bool canParseVehicleShape ( const std::string &  shape)

Checks whether the given string contains only known vehicle shape.

Definition at line 308 of file SUMOVehicleClass.cpp.

References StringBijection< T >::hasString().

Referenced by GNECalibratorVehicleType::setShape().

◆ getVehicleClassCompoundID()

int getVehicleClassCompoundID ( const std::string &  name)

Returns the OR'ed id of the compound class given by its name.

Parameters
[in]nameThe name of the abstract vehicle class
Returns
The OR'ed combination of base enum values

Definition at line 185 of file SUMOVehicleClass.cpp.

References StringBijection< T >::get(), StringBijection< T >::getStrings(), and SVC_IGNORING.

◆ getVehicleClassID()

SUMOVehicleClass getVehicleClassID ( const std::string &  name)

Returns the class id of the abstract class given by its name.

Parameters
[in]nameThe name of the abstract vehicle class
Returns
The internal representation of this class. Name must not be a compound name

Definition at line 176 of file SUMOVehicleClass.cpp.

References StringBijection< T >::get(), and StringBijection< T >::hasString().

Referenced by NIXMLTypesHandler::myStartElement(), RONetHandler::myStartElement(), NLHandler::myStartElement(), SUMOVehicleParserHelper::parseVehicleClass(), parseVehicleClasses(), GNECalibratorVehicleType::setVClass(), and TraCI_VehicleType::setVehicleClass().

◆ getVehicleClassNames()

◆ getVehicleClassNamesList()

std::vector<std::string> getVehicleClassNamesList ( SVCPermissions  permissions)

Returns the ids of the given classes, divided using a ' '.

Parameters
[in]thepermissions to encode
Returns
The string representation of these classes as a vector
Todo:
cache values?

Definition at line 161 of file SUMOVehicleClass.cpp.

References StringBijection< T >::get(), StringBijection< T >::getStrings(), and SVC_IGNORING.

Referenced by TraCI_Lane::getAllowed(), TraCI_Lane::getDisallowed(), and getVehicleClassNames().

◆ getVehicleShapeID()

SUMOVehicleShape getVehicleShapeID ( const std::string &  name)

Returns the class id of the shape class given by its name.

Parameters
[in]nameThe name of the shape class
Returns
The internal representation of this class

Definition at line 299 of file SUMOVehicleClass.cpp.

References StringBijection< T >::get(), and StringBijection< T >::hasString().

Referenced by GNECalibratorVehicleType::setShape(), and TraCI_VehicleType::setShapeClass().

◆ getVehicleShapeName()

std::string getVehicleShapeName ( SUMOVehicleShape  id)

Returns the class name of the shape class given by its id.

Parameters
[in]idThe id of the shape class
Returns
The string representation of this class

Definition at line 314 of file SUMOVehicleClass.cpp.

References StringBijection< T >::getString().

Referenced by TraCI_VehicleType::getShapeClass(), GNECalibratorVehicleTypeDialog::updateCalibratorVehicleTypeValues(), and SUMOVTypeParameter::write().

◆ isForbidden()

bool isForbidden ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a forbidden edge.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is forbidden

Definition at line 329 of file SUMOVehicleClass.cpp.

References DEFAULT_CONTAINER_TRANSHIP_SPEED(), DEFAULT_PEDESTRIAN_SPEED(), DEFAULT_PEDTYPE_ID(), DEFAULT_VEH_PROB(), DEFAULT_VTYPE_ID(), and SVCAll.

Referenced by NBNode::ApproachingDivider::ApproachingDivider(), NBOwnTLDef::computeLogicAndConts(), NBEdge::divideOnEdges(), NBOwnTLDef::patchStateForCrossings(), and NBEdge::recheckLanes().

◆ isRailway()

bool isRailway ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a railway edge.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is a railway edge

Definition at line 319 of file SUMOVehicleClass.cpp.

References SVC_PASSENGER, SVC_RAIL, SVC_RAIL_ELECTRIC, SVC_RAIL_URBAN, and SVC_TRAM.

Referenced by GNENet::addReversedEdge(), NBTrafficLightDefinition::collectAllLinks(), GNELane::drawAsRailway(), GUILane::drawAsRailway(), GNELane::getColorValue(), GUILane::getColorValue(), NWWriter_OpenDrive::getLaneType(), NBNode::getLinkState(), NBEdge::recheckLanes(), and NBEdge::shiftPositionAtNode().

◆ isWaterway()

bool isWaterway ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a waterway edge.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is a waterway edge

Definition at line 324 of file SUMOVehicleClass.cpp.

References SVC_SHIP.

Referenced by NBNodeTypeComputer::computeNodeTypes(), NBNodeTypeComputer::computeSingleNodeType(), GNELane::drawAsWaterway(), GUILane::drawAsWaterway(), GUILane::drawGL(), and GUIJunctionWrapper::GUIJunctionWrapper().

◆ parseVehicleClasses() [1/3]

◆ parseVehicleClasses() [2/3]

SVCPermissions parseVehicleClasses ( const std::string &  allowedS,
const std::string &  disallowedS 
)

Encodes the given vector of allowed and disallowed classes into a bitset.

Parameters
[in]allowedSDefinition which classes are allowed
[in]disallowedSDefinition which classes are not allowed

Definition at line 236 of file SUMOVehicleClass.cpp.

References parseVehicleClasses(), SVCAll, and WRITE_WARNING.

◆ parseVehicleClasses() [3/3]

SVCPermissions parseVehicleClasses ( const std::vector< std::string > &  allowedS)

Encodes the given vector of allowed classs into a bitset Unlike the methods which parse a string it gives immediately a warning output on deprecated vehicle classes.

Parameters
[in]classesSThe names vector to parse

Definition at line 251 of file SUMOVehicleClass.cpp.

References StringBijection< T >::getString(), getVehicleClassID(), and WRITE_WARNING.

◆ writePermissions()

void writePermissions ( OutputDevice into,
SVCPermissions  permissions 
)

◆ writePreferences()

void writePreferences ( OutputDevice into,
SVCPermissions  preferred 
)

writes allowed disallowed attributes if needed;

Definition at line 289 of file SUMOVehicleClass.cpp.

References getVehicleClassNames(), SUMO_ATTR_PREFER, SVCAll, and OutputDevice::writeAttr().

Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_SUMO::writeLane().

Variable Documentation

◆ DEFAULT_CONTAINER_TRANSHIP_SPEED

const double DEFAULT_CONTAINER_TRANSHIP_SPEED

◆ DEFAULT_PEDESTRIAN_SPEED

const double DEFAULT_PEDESTRIAN_SPEED

◆ DEFAULT_PEDTYPE_ID

◆ DEFAULT_VEH_PROB

◆ DEFAULT_VTYPE_ID

◆ deprecatedVehicleClassesSeen

std::set<std::string> deprecatedVehicleClassesSeen

◆ SUMOVehicleClass_MAX

const int SUMOVehicleClass_MAX

Definition at line 141 of file SUMOVehicleClass.cpp.

Referenced by writePermissions().

◆ SumoVehicleClassStrings

◆ SumoVehicleShapeStrings

◆ SVC_UNSPECIFIED

const SVCPermissions SVC_UNSPECIFIED

permissions not specified

Definition at line 143 of file SUMOVehicleClass.cpp.

Referenced by NIXMLEdgesHandler::addEdge(), and NWWriter_SUMO::writeLane().

◆ SVCAll