SUMO - Simulation of Urban MObility
SUMOVehicleClass.cpp File Reference
#include <config.h>
#include <string>
#include <map>
#include "SUMOVehicleClass.h"
#include <utils/common/TplConvert.h>
#include <utils/common/ToString.h>
#include <utils/common/MsgHandler.h>
#include <utils/common/StringTokenizer.h>

Go to the source code of this file.

Functions

bool canParseVehicleClasses (const std::string &classes)
 Checks whether the given string contains only known vehicle classes. More...
 
const SUMOReal DEFAULT_PEDESTRIAN_SPEED (5./3.6)
 
const SUMOReal DEFAULT_VEH_PROB (1.)
 
const std::string DEFAULT_VTYPE_ID ("DEFAULT_VEHTYPE")
 
int getVehicleClassCompoundID (const std::string &name)
 Returns the OR'ed id of the compound class given by its name. More...
 
std::string getVehicleClassCompoundName (int id)
 
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...
 
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...
 

Variables

std::set< std::string > deprecatedVehicleClassesSeen
 
const int SUMOVehicleClass_MAX = SVC_CUSTOM2
 
StringBijection< SUMOVehicleClass >::Entry sumoVehicleClassStringInitializer []
 
StringBijection< SUMOVehicleClassSumoVehicleClassStrings (sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
 
StringBijection< SUMOVehicleShape >::Entry sumoVehicleShapeStringInitializer []
 
StringBijection< SUMOVehicleShapeSumoVehicleShapeStrings (sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false)
 
const SVCPermissions SVCAll = 2 * SUMOVehicleClass_MAX - 1
 

Detailed Description

Author
Daniel Krajzewicz
Jakob Erdmann
Michael Behrisch
Walter Bamberger
Date
2006-01-24
Version
Id
SUMOVehicleClass.cpp 16560 2014-06-09 20:54:15Z behrisch

Definition in file SUMOVehicleClass.cpp.

Function Documentation

bool canParseVehicleClasses ( const std::string &  classes)

Checks whether the given string contains only known vehicle classes.

Definition at line 231 of file SUMOVehicleClass.cpp.

References StringTokenizer::hasNext(), StringTokenizer::next(), and SumoVehicleClassStrings.

const SUMOReal DEFAULT_PEDESTRIAN_SPEED ( 5./3.  6)
const SUMOReal DEFAULT_VEH_PROB ( 1.  )
const std::string DEFAULT_VTYPE_ID ( "DEFAULT_VEHTYPE"  )
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 198 of file SUMOVehicleClass.cpp.

References SumoVehicleClassStrings, and SVC_IGNORING.

std::string getVehicleClassCompoundName ( int  id)

Definition at line 148 of file SUMOVehicleClass.cpp.

References SumoVehicleClassStrings.

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

References SumoVehicleClassStrings.

Referenced by 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 165 of file SUMOVehicleClass.cpp.

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

Referenced by GUILane::getParameterWindow(), NWWriter_SUMO::writePermissions(), and NWWriter_SUMO::writePreferences().

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

References SumoVehicleClassStrings, 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 275 of file SUMOVehicleClass.cpp.

References SumoVehicleShapeStrings.

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

References SumoVehicleShapeStrings.

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

References SVCAll.

Referenced by NBNode::ApproachingDivider::ApproachingDivider(), NBEdge::divideOnEdges(), NBOwnTLDef::myCompute(), 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 290 of file SUMOVehicleClass.cpp.

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

Referenced by GUILane::drawGL(), GUILane::drawLinkRule(), and NBRampsComputer::fulfillsRampConstraints().

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

References deprecatedVehicleClassesSeen, getVehicleClassID(), StringTokenizer::hasNext(), StringTokenizer::next(), SumoVehicleClassStrings, and SVCAll.

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

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

References getVehicleClassID(), SumoVehicleClassStrings, and WRITE_WARNING.

Variable Documentation

std::set<std::string> deprecatedVehicleClassesSeen
const int SUMOVehicleClass_MAX = SVC_CUSTOM2

Definition at line 138 of file SUMOVehicleClass.cpp.

Referenced by NWWriter_SUMO::writePermissions().

StringBijection<SUMOVehicleClass>::Entry sumoVehicleClassStringInitializer[]

Definition at line 51 of file SUMOVehicleClass.cpp.

StringBijection<SUMOVehicleShape>::Entry sumoVehicleShapeStringInitializer[]

Definition at line 94 of file SUMOVehicleClass.cpp.