![]() |
SUMO - Simulation of Urban MObility
|
#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>
#include <utils/iodevices/OutputDevice.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_CONTAINER_TRANSHIP_SPEED (5./3.6) |
const SUMOReal | DEFAULT_PEDESTRIAN_SPEED (5./3.6) |
const std::string | DEFAULT_PEDTYPE_ID ("DEFAULT_PEDTYPE") |
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... | |
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 | |
std::set< std::string > | deprecatedVehicleClassesSeen |
const int | SUMOVehicleClass_MAX = SVC_CUSTOM2 |
StringBijection< SUMOVehicleClass >::Entry | sumoVehicleClassStringInitializer [] |
StringBijection< SUMOVehicleClass > | SumoVehicleClassStrings (sumoVehicleClassStringInitializer, SVC_CUSTOM2, false) |
StringBijection< SUMOVehicleShape >::Entry | sumoVehicleShapeStringInitializer [] |
StringBijection< SUMOVehicleShape > | SumoVehicleShapeStrings (sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false) |
const SVCPermissions | SVC_UNSPECIFIED = -1 |
const SVCPermissions | SVCAll = 2 * SUMOVehicleClass_MAX - 1 |
Definition in file SUMOVehicleClass.cpp.
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().
const SUMOReal DEFAULT_CONTAINER_TRANSHIP_SPEED | ( | 5./3. | 6 | ) |
Referenced by isForbidden().
const SUMOReal DEFAULT_PEDESTRIAN_SPEED | ( | 5./3. | 6 | ) |
Referenced by isForbidden().
const std::string DEFAULT_PEDTYPE_ID | ( | "DEFAULT_PEDTYPE" | ) |
Referenced by isForbidden().
const SUMOReal DEFAULT_VEH_PROB | ( | 1. | ) |
Referenced by isForbidden().
const std::string DEFAULT_VTYPE_ID | ( | "DEFAULT_VEHTYPE" | ) |
Referenced by isForbidden().
int getVehicleClassCompoundID | ( | const std::string & | name | ) |
Returns the OR'ed id of the compound class given by its name.
[in] | name | The name of the abstract vehicle class |
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.
[in] | name | The name of the abstract vehicle class |
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 ' '.
[in] | the | permissions to encode |
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 ' '.
[in] | the | permissions to encode |
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.
[in] | name | The name of the shape 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.
[in] | id | The id of the shape 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.
[in] | permissions | The permissions of the edge |
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.
[in] | permissions | The permissions of the 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.
[in] | permissions | The permissions of the 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.
[in] | classNames | Space separated class names |
[out] | container | The 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.
[in] | allowedS | Definition which classes are allowed |
[in] | disallowedS | Definition 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.
[in] | classesS | The 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 | ||
) |
writes allowed disallowed attributes if needed;
Definition at line 263 of file SUMOVehicleClass.cpp.
References getVehicleClassNames(), StringBijection< T >::size(), SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SUMOVehicleClass_MAX, SVCAll, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeLane(), and NBTypeCont::writeTypes().
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().
std::set<std::string> deprecatedVehicleClassesSeen |
Definition at line 93 of file SUMOVehicleClass.cpp.
Referenced by NIImporter_SUMO::_loadNetwork(), NLEdgeControlBuilder::build(), loadNet(), ROLoader::loadNet(), NILoader::loadXML(), and parseVehicleClasses().
const int SUMOVehicleClass_MAX = SVC_CUSTOM2 |
Definition at line 142 of file SUMOVehicleClass.cpp.
Referenced by writePermissions().
StringBijection<SUMOVehicleClass>::Entry sumoVehicleClassStringInitializer[] |
Definition at line 52 of file SUMOVehicleClass.cpp.
StringBijection<SUMOVehicleClass> SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false) |
Referenced by CHRouter< E, V, PF >::buildContractionHierarchy(), GNEAttributeCarrier::discreteChoices(), GUIApplicationWindow::fillMenuBar(), GUIMEVehicle::getTypeParameterWindow(), GUIVehicle::getTypeParameterWindow(), GUIApplicationWindow::onCmdEditChosen(), SUMOVehicleParserHelper::parseVehicleClass(), and toString< SUMOVehicleClass >().
StringBijection<SUMOVehicleShape>::Entry sumoVehicleShapeStringInitializer[] |
Definition at line 96 of file SUMOVehicleClass.cpp.
StringBijection<SUMOVehicleShape> SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false) |
Referenced by SUMOVehicleParserHelper::parseGuiShape().
const SVCPermissions SVC_UNSPECIFIED = -1 |
Definition at line 144 of file SUMOVehicleClass.cpp.
Referenced by NIXMLEdgesHandler::addEdge(), and NWWriter_SUMO::writeLane().
const SVCPermissions SVCAll = 2 * SUMOVehicleClass_MAX - 1 |
Definition at line 143 of file SUMOVehicleClass.cpp.
Referenced by NLHandler::addLane(), NINavTeqHelper::addVehicleClasses(), NINavTeqHelper::addVehicleClassesV6(), NBEdge::dismissVehicleClassInformation(), NWWriter_DlrNavteq::getAllowedTypes(), NBEdge::getFirstNonPedestrianLaneIndex(), NWWriter_OpenDrive::getLaneType(), getVehicleClassNames(), GNEViewNet::GNEViewNet(), GUIVisualizationSettings::GUIVisualizationSettings(), NBEdge::hasPermissions(), MSEdge::initialize(), isForbidden(), MSTriggeredRerouter::myEndElement(), MSTriggeredRerouter::notifyEnter(), NIImporter_VISUM::parse_Types(), RONetHandler::parseLane(), parseVehicleClasses(), TraCIServerAPI_Lane::processGet(), MSEdge::rebuildAllowedLanes(), ROEdge::ROEdge(), MSTriggeredRerouter::setPermissions(), NWWriter_SUMO::writeInternalEdges(), writePermissions(), and writePreferences().