![]() |
SUMO - Simulation of Urban MObility
|
A storage for available types of edges. More...
#include <NBTypeCont.h>
Data Structures | |
struct | TypeDefinition |
Public Member Functions | |
bool | addRestriction (const std::string &id, const SUMOVehicleClass svc, const double speed) |
Adds a restriction to a type. More... | |
bool | copyRestrictionsAndAttrs (const std::string &fromId, const std::string &toId) |
Copy restrictions to a type. More... | |
void | insert (const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth) |
Adds a type into the list. More... | |
bool | knows (const std::string &type) const |
Returns whether the named type is in the container. More... | |
bool | markAsSet (const std::string &id, const SumoXMLAttr attr) |
Marks an attribute of a type as set. More... | |
bool | markAsToDiscard (const std::string &id) |
Marks a type as to be discarded. More... | |
NBTypeCont () | |
Constructor. More... | |
void | setDefaults (int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions) |
Sets the default values. More... | |
int | size () const |
Returns the number of known types. More... | |
void | writeTypes (OutputDevice &into) const |
writes all types a s XML More... | |
~NBTypeCont () | |
Destructor. More... | |
Type-dependant Retrieval methods | |
int | getNumLanes (const std::string &type) const |
Returns the number of lanes for the given type. More... | |
double | getSpeed (const std::string &type) const |
Returns the maximal velocity for the given type [m/s]. More... | |
int | getPriority (const std::string &type) const |
Returns the priority for the given type. More... | |
bool | getIsOneWay (const std::string &type) const |
Returns whether edges are one-way per default for the given type. More... | |
bool | getShallBeDiscarded (const std::string &type) const |
Returns the information whether edges of this type shall be discarded. More... | |
bool | wasSet (const std::string &type, const SumoXMLAttr attr) const |
Returns whether an attribute of a type was set. More... | |
SVCPermissions | getPermissions (const std::string &type) const |
Returns allowed vehicle classes for the given type. More... | |
double | getWidth (const std::string &type) const |
Returns the lane width for the given type [m]. More... | |
double | getSidewalkWidth (const std::string &type) const |
Returns the lane width for a sidewalk to be added [m]. More... | |
double | getBikeLaneWidth (const std::string &type) const |
Returns the lane width for a bike lane to be added [m]. More... | |
Private Types | |
typedef std::map< std::string, TypeDefinition > | TypesCont |
A container of types, accessed by the string id. More... | |
Private Member Functions | |
const TypeDefinition & | getType (const std::string &name) const |
Retrieve the name or the default type. More... | |
NBTypeCont (const NBTypeCont &s) | |
invalid copy constructor More... | |
NBTypeCont & | operator= (const NBTypeCont &s) |
invalid assignment operator More... | |
Private Attributes | |
TypeDefinition | myDefaultType |
The default type. More... | |
TypesCont | myTypes |
The container of types. More... | |
A storage for available types of edges.
NBTypeCont stores properties of edge-types of edges. Additionally, a default type is stored which is used if no type information is given.
This structure also contains a structure for determining node types using edge speeds.
Definition at line 61 of file NBTypeCont.h.
|
private |
A container of types, accessed by the string id.
Definition at line 301 of file NBTypeCont.h.
|
inline |
Constructor.
Definition at line 64 of file NBTypeCont.h.
|
inline |
|
private |
invalid copy constructor
bool NBTypeCont::addRestriction | ( | const std::string & | id, |
const SUMOVehicleClass | svc, | ||
const double | speed | ||
) |
Adds a restriction to a type.
[in] | id | The id of the type |
[in] | svc | The vehicle class the restriction refers to |
[in] | speed | The restricted speed |
Definition at line 102 of file NBTypeCont.cpp.
References myTypes.
Referenced by NIXMLTypesHandler::myStartElement(), and size().
bool NBTypeCont::copyRestrictionsAndAttrs | ( | const std::string & | fromId, |
const std::string & | toId | ||
) |
Copy restrictions to a type.
[in] | fromId | The id of the source type |
[in] | toId | The id of the destination type |
Definition at line 113 of file NBTypeCont.cpp.
References myTypes.
Referenced by NIImporter_OpenStreetMap::insertEdge(), and size().
double NBTypeCont::getBikeLaneWidth | ( | const std::string & | type | ) | const |
Returns the lane width for a bike lane to be added [m].
If the named type is not known, the default is returned
[in] | type | The name of the type to return the width for |
Definition at line 228 of file NBTypeCont.cpp.
References NBTypeCont::TypeDefinition::bikeLaneWidth, and getType().
Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), and size().
bool NBTypeCont::getIsOneWay | ( | const std::string & | type | ) | const |
Returns whether edges are one-way per default for the given type.
If the named type is not known, the default is returned
[in] | type | The name of the type to return the one-way information for |
Definition at line 192 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::oneWay.
Referenced by NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), and size().
int NBTypeCont::getNumLanes | ( | const std::string & | type | ) | const |
Returns the number of lanes for the given type.
If the named type is not known, the default is returned
[in] | type | The name of the type to return the lane number for |
Definition at line 174 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::numLanes.
Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), size(), and NGNet::toNB().
SVCPermissions NBTypeCont::getPermissions | ( | const std::string & | type | ) | const |
Returns allowed vehicle classes for the given type.
If the named type is not known, the default is returned
[in] | type | The name of the type to return the list of allowed vehicles classes for |
Definition at line 210 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::permissions.
Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenDrive::findWidthSplit(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), NIImporter_DlrNavteq::EdgesHandler::report(), and size().
int NBTypeCont::getPriority | ( | const std::string & | type | ) | const |
Returns the priority for the given type.
If the named type is not known, the default is returned
[in] | type | The name of the type to return the priority for |
Definition at line 186 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::priority.
Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), size(), and NGNet::toNB().
bool NBTypeCont::getShallBeDiscarded | ( | const std::string & | type | ) | const |
Returns the information whether edges of this type shall be discarded.
Returns false if the type is not known.
[in] | type | The id of the type |
Definition at line 198 of file NBTypeCont.cpp.
References NBTypeCont::TypeDefinition::discard, and getType().
Referenced by NIImporter_OpenDrive::OpenDriveLaneSection::buildLaneMapping(), NIImporter_OpenDrive::findWidthSplit(), NBEdgeCont::ignoreFilterMatch(), NIImporter_OpenStreetMap::insertEdge(), and size().
double NBTypeCont::getSidewalkWidth | ( | const std::string & | type | ) | const |
Returns the lane width for a sidewalk to be added [m].
If the named type is not known, the default is returned
[in] | type | The name of the type to return the width for |
Definition at line 222 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::sidewalkWidth.
Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), and size().
double NBTypeCont::getSpeed | ( | const std::string & | type | ) | const |
Returns the maximal velocity for the given type [m/s].
If the named type is not known, the default is returned
[in] | type | The name of the type to return the speed for |
Definition at line 180 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::speed.
Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenDrive::OpenDriveLaneSection::buildSpeedChanges(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), size(), and NGNet::toNB().
|
private |
Retrieve the name or the default type.
If no name is given, the default type is returned
[in] | name | The name of the type to retrieve |
Definition at line 234 of file NBTypeCont.cpp.
References myDefaultType, and myTypes.
Referenced by getBikeLaneWidth(), getIsOneWay(), getNumLanes(), getPermissions(), getPriority(), getShallBeDiscarded(), getSidewalkWidth(), getSpeed(), getWidth(), and wasSet().
double NBTypeCont::getWidth | ( | const std::string & | type | ) | const |
Returns the lane width for the given type [m].
If the named type is not known, the default is returned
[in] | type | The name of the type to return the width for |
Definition at line 216 of file NBTypeCont.cpp.
References getType(), and NBTypeCont::TypeDefinition::width.
Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), size(), and NGNet::toNB().
void NBTypeCont::insert | ( | const std::string & | id, |
int | numLanes, | ||
double | maxSpeed, | ||
int | prio, | ||
SVCPermissions | permissions, | ||
double | width, | ||
bool | oneWayIsDefault, | ||
double | sidewalkWidth, | ||
double | bikeLaneWidth | ||
) |
Adds a type into the list.
[in] | id | The id of the type |
[in] | numLanes | The number of lanes an edge of this type has |
[in] | maxSpeed | The speed allowed on an edge of this type |
[in] | prio | The priority of an edge of this type |
[in] | permissions | The encoding of vehicle classes allowed on an edge of this type |
[in] | width | The width of lanes of edgesof this type |
[in] | oneWayIsDefault | Whether edges of this type are one-way per default |
Definition at line 60 of file NBTypeCont.cpp.
References NBTypeCont::TypeDefinition::attrs, myTypes, and NBTypeCont::TypeDefinition::restrictions.
Referenced by NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Types(), and ~NBTypeCont().
bool NBTypeCont::knows | ( | const std::string & | type | ) | const |
Returns whether the named type is in the container.
Definition at line 74 of file NBTypeCont.cpp.
References myTypes.
Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenDrive::OpenDriveLaneSection::buildLaneMapping(), NIImporter_OpenDrive::findWidthSplit(), NBEdgeCont::ignoreFilterMatch(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), NIImporter_DlrNavteq::EdgesHandler::report(), and size().
bool NBTypeCont::markAsSet | ( | const std::string & | id, |
const SumoXMLAttr | attr | ||
) |
Marks an attribute of a type as set.
[in] | id | The id of the type |
[in] | attr | The id of the attribute |
Definition at line 91 of file NBTypeCont.cpp.
References myTypes.
Referenced by NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Types(), and size().
bool NBTypeCont::markAsToDiscard | ( | const std::string & | id | ) |
Marks a type as to be discarded.
[in] | id | The id of the type |
Definition at line 80 of file NBTypeCont.cpp.
References myTypes.
Referenced by NIXMLTypesHandler::myStartElement(), and size().
|
private |
invalid assignment operator
void NBTypeCont::setDefaults | ( | int | defaultNumLanes, |
double | defaultLaneWidth, | ||
double | defaultSpeed, | ||
int | defaultPriority, | ||
SVCPermissions | defaultPermissions | ||
) |
Sets the default values.
[in] | defaultNumLanes | The default number of lanes an edge has |
[in] | defaultLaneWidth | The default width of lanes |
[in] | defaultSpeed | The default speed allowed on an edge |
[in] | defaultPriority | The default priority of an edge |
[in] | defaultPermissions | The default permissions of an edge |
Definition at line 46 of file NBTypeCont.cpp.
References myDefaultType, NBTypeCont::TypeDefinition::numLanes, NBTypeCont::TypeDefinition::permissions, NBTypeCont::TypeDefinition::priority, NBTypeCont::TypeDefinition::speed, and NBTypeCont::TypeDefinition::width.
Referenced by NBNetBuilder::applyOptions(), and ~NBTypeCont().
|
inline |
Returns the number of known types.
Definition at line 103 of file NBTypeCont.h.
References addRestriction(), copyRestrictionsAndAttrs(), getBikeLaneWidth(), getIsOneWay(), getNumLanes(), getPermissions(), getPriority(), getShallBeDiscarded(), getSidewalkWidth(), getSpeed(), getWidth(), knows(), markAsSet(), markAsToDiscard(), myTypes, wasSet(), and writeTypes().
Referenced by NILoader::load(), and NWWriter_XML::writeNetwork().
bool NBTypeCont::wasSet | ( | const std::string & | type, |
const SumoXMLAttr | attr | ||
) | const |
Returns whether an attribute of a type was set.
[in] | type | The id of the type |
[in] | attr | The id of the attribute |
Definition at line 204 of file NBTypeCont.cpp.
References NBTypeCont::TypeDefinition::attrs, and getType().
Referenced by size().
void NBTypeCont::writeTypes | ( | OutputDevice & | into | ) | const |
writes all types a s XML
Definition at line 126 of file NBTypeCont.cpp.
References NBTypeCont::TypeDefinition::attrs, NBTypeCont::TypeDefinition::bikeLaneWidth, OutputDevice::closeTag(), NBTypeCont::TypeDefinition::discard, getVehicleClassNames(), OutputDevice::lf(), myTypes, NBTypeCont::TypeDefinition::numLanes, NBTypeCont::TypeDefinition::oneWay, OutputDevice::openTag(), NBTypeCont::TypeDefinition::permissions, NBTypeCont::TypeDefinition::priority, NBTypeCont::TypeDefinition::restrictions, NBTypeCont::TypeDefinition::sidewalkWidth, NBTypeCont::TypeDefinition::speed, SUMO_ATTR_ALLOW, SUMO_ATTR_BIKELANEWIDTH, SUMO_ATTR_DISALLOW, SUMO_ATTR_DISCARD, SUMO_ATTR_ID, SUMO_ATTR_NUMLANES, SUMO_ATTR_ONEWAY, SUMO_ATTR_PRIORITY, SUMO_ATTR_SIDEWALKWIDTH, SUMO_ATTR_SPEED, SUMO_ATTR_VCLASS, SUMO_ATTR_WIDTH, SUMO_TAG_RESTRICTION, SUMO_TAG_TYPE, NBTypeCont::TypeDefinition::width, OutputDevice::writeAttr(), and writePermissions().
Referenced by size(), NWWriter_SUMO::writeNetwork(), and NWWriter_XML::writeTypes().
|
private |
The default type.
Definition at line 298 of file NBTypeCont.h.
Referenced by getType(), and setDefaults().
|
private |
The container of types.
Definition at line 304 of file NBTypeCont.h.
Referenced by addRestriction(), copyRestrictionsAndAttrs(), getType(), insert(), knows(), markAsSet(), markAsToDiscard(), size(), and writeTypes().