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:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int SUMOEmissionClass
 
typedef int SVCPermissions
 

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
}
 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...
 
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)
 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 SUMOReal DEFAULT_CONTAINER_TRANSHIP_SPEED
 
const SUMOReal DEFAULT_PEDESTRIAN_SPEED
 
const std::string DEFAULT_PEDTYPE_ID
 
const SUMOReal 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
 
const SVCPermissions SVCAll
 

Detailed Description

Author
Daniel Krajzewicz
Jakob Erdmann
Michael Behrisch
Walter Bamberger
Date
2006-01-24
Version
Id
SUMOVehicleClass.h 20433 2016-04-13 08:00:14Z behrisch

Definition in file SUMOVehicleClass.h.

Typedef Documentation

typedef int SUMOEmissionClass

Definition at line 219 of file SUMOVehicleClass.h.

typedef int SVCPermissions

Definition at line 209 of file SUMOVehicleClass.h.

Enumeration Type Documentation

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 132 of file SUMOVehicleClass.h.

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

Definition at line 57 of file SUMOVehicleClass.h.

Function Documentation

bool canParseVehicleClasses ( const std::string &  classes)

Checks whether the given string contains only known vehicle classes.

Definition at line 219 of file SUMOVehicleClass.cpp.

References StringTokenizer::hasNext(), StringBijection< T >::hasString(), and StringTokenizer::next().

Referenced by GNEEdge::isValid(), and GNELane::isValid().

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 186 of file SUMOVehicleClass.cpp.

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

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 177 of file SUMOVehicleClass.cpp.

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

Referenced by NIXMLTypesHandler::myStartElement(), RONetHandler::myStartElement(), NLHandler::myStartElement(), SUMOVehicleParserHelper::parseVehicleClass(), parseVehicleClasses(), and TraCIServerAPI_VehicleType::setVariable().

std::string getVehicleClassNames ( SVCPermissions  permissions)

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

Parameters
[in]thepermissions to encode
Returns
The string representation of these classes

Definition at line 153 of file SUMOVehicleClass.cpp.

References getVehicleClassNamesList(), joinToString(), and SVCAll.

Referenced by GNEEdge::getAttribute(), GNELane::getAttribute(), GUILane::getParameterWindow(), writePermissions(), writePreferences(), and NBTypeCont::writeTypes().

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 162 of file SUMOVehicleClass.cpp.

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

Referenced by getVehicleClassNames(), and TraCIServerAPI_Lane::processGet().

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 296 of file SUMOVehicleClass.cpp.

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

Referenced by TraCIServerAPI_VehicleType::setVariable().

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 306 of file SUMOVehicleClass.cpp.

References StringBijection< T >::getString().

Referenced by TraCIServerAPI_VehicleType::getVariable(), and SUMOVTypeParameter::write().

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 321 of file SUMOVehicleClass.cpp.

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

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

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 311 of file SUMOVehicleClass.cpp.

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

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

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 316 of file SUMOVehicleClass.cpp.

References SVC_SHIP.

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

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.

Parameters
[in]classNamesSpace separated class names
[out]containerThe set of vehicle classes to fill throws ProcessError if parsing fails

Definition at line 199 of file SUMOVehicleClass.cpp.

References deprecatedVehicleClassesSeen, StringBijection< T >::getString(), getVehicleClassID(), StringTokenizer::hasNext(), StringTokenizer::next(), and SVCAll.

Referenced by NIImporter_SUMO::_loadNetwork(), NIXMLEdgesHandler::addEdge(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), NBEdgeCont::applyOptions(), NIXMLTypesHandler::myStartElement(), MSTriggeredRerouter::myStartElement(), RONetHandler::parseLane(), parseVehicleClasses(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_Lane::processSet(), and GNELane::setAttribute().

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 233 of file SUMOVehicleClass.cpp.

References parseVehicleClasses(), SVCAll, and WRITE_WARNING.

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 248 of file SUMOVehicleClass.cpp.

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

void writePermissions ( OutputDevice into,
SVCPermissions  permissions 
)
void writePreferences ( OutputDevice into,
SVCPermissions  preferred 
)

writes allowed disallowed attributes if needed;

Definition at line 286 of file SUMOVehicleClass.cpp.

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

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

Variable Documentation

const SUMOReal DEFAULT_CONTAINER_TRANSHIP_SPEED
const SUMOReal DEFAULT_PEDESTRIAN_SPEED
std::set<std::string> deprecatedVehicleClassesSeen
const int SUMOVehicleClass_MAX

Definition at line 142 of file SUMOVehicleClass.cpp.

Referenced by writePermissions().

const SVCPermissions SVC_UNSPECIFIED

Definition at line 144 of file SUMOVehicleClass.cpp.

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