Eclipse SUMO - Simulation of Urban MObility
NBTypeCont Class Reference

A storage for available types of edges. More...

#include <NBTypeCont.h>

Collaboration diagram for NBTypeCont:

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, double widthResolution, double maxWidth, double minWidth)
 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...
 
double getWidthResolution (const std::string &type) const
 Returns the resolution for interpreting edge/lane widths of the given type. More...
 
double getMaxWidth (const std::string &type) const
 Returns the maximum edge/lane widths of the given type. More...
 
double getMinWidth (const std::string &type) const
 Returns the minimum edge/lane widths of the given type. 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, TypeDefinitionTypesCont
 A container of types, accessed by the string id. More...
 

Private Member Functions

const TypeDefinitiongetType (const std::string &name) const
 Retrieve the name or the default type. More...
 
 NBTypeCont (const NBTypeCont &s)
 invalid copy constructor More...
 
NBTypeContoperator= (const NBTypeCont &s)
 invalid assignment operator More...
 

Private Attributes

TypeDefinition myDefaultType
 The default type. More...
 
TypesCont myTypes
 The container of types. More...
 

Detailed Description

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 54 of file NBTypeCont.h.

Member Typedef Documentation

◆ TypesCont

typedef std::map<std::string, TypeDefinition> NBTypeCont::TypesCont
private

A container of types, accessed by the string id.

Definition at line 340 of file NBTypeCont.h.

Constructor & Destructor Documentation

◆ NBTypeCont() [1/2]

NBTypeCont::NBTypeCont ( )
inline

Constructor.

Definition at line 57 of file NBTypeCont.h.

◆ ~NBTypeCont()

NBTypeCont::~NBTypeCont ( )
inline

Destructor.

Definition at line 61 of file NBTypeCont.h.

◆ NBTypeCont() [2/2]

NBTypeCont::NBTypeCont ( const NBTypeCont s)
private

invalid copy constructor

Member Function Documentation

◆ addRestriction()

bool NBTypeCont::addRestriction ( const std::string &  id,
const SUMOVehicleClass  svc,
const double  speed 
)

Adds a restriction to a type.

Parameters
[in]idThe id of the type
[in]svcThe vehicle class the restriction refers to
[in]speedThe restricted speed

Definition at line 99 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIXMLTypesHandler::myStartElement().

◆ copyRestrictionsAndAttrs()

bool NBTypeCont::copyRestrictionsAndAttrs ( const std::string &  fromId,
const std::string &  toId 
)

Copy restrictions to a type.

Parameters
[in]fromIdThe id of the source type
[in]toIdThe id of the destination type

Definition at line 110 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIImporter_OpenStreetMap::usableType().

◆ getBikeLaneWidth()

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

Parameters
[in]typeThe name of the type to return the width for
Returns
The width of lanes of edges of this type

Definition at line 239 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::bikeLaneWidth, and getType().

Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), and NIImporter_OpenStreetMap::usableType().

◆ getIsOneWay()

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

Parameters
[in]typeThe name of the type to return the one-way information for
Returns
Whether edges of this type are one-way per default
Todo:
There is no default for one-way!?

Definition at line 189 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::oneWay.

Referenced by NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), and NIImporter_OpenStreetMap::usableType().

◆ getMaxWidth()

double NBTypeCont::getMaxWidth ( const std::string &  type) const

Returns the maximum edge/lane widths of the given type.

If the named type is not known, the default is returned

Parameters
[in]typeThe name of the type to return the maximum width for
Returns
The maximum width on edges of this type

Definition at line 205 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::maxWidth.

Referenced by NIXMLTypesHandler::myStartElement(), and NIImporter_OpenDrive::setLaneAttributes().

◆ getMinWidth()

double NBTypeCont::getMinWidth ( const std::string &  type) const

Returns the minimum edge/lane widths of the given type.

If the named type is not known, the default is returned

Parameters
[in]typeThe name of the type to return the maximum width for
Returns
The minimum width on edges of this type

Definition at line 210 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::minWidth.

Referenced by NIXMLTypesHandler::myStartElement().

◆ getNumLanes()

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

Parameters
[in]typeThe name of the type to return the lane number for
Returns
The number of lanes an edge of this type has

Definition at line 171 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(), and NIImporter_OpenStreetMap::usableType().

◆ getPermissions()

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

Parameters
[in]typeThe name of the type to return the list of allowed vehicles classes for
Returns
List of vehicles class which may use edges of the given type

Definition at line 221 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::permissions.

Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::extendRailwayDistances(), NIImporter_OpenDrive::findWidthSplit(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), NIImporter_OpenDrive::setLaneAttributes(), and NIImporter_OpenStreetMap::usableType().

◆ getPriority()

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

Parameters
[in]typeThe name of the type to return the priority for
Returns
The priority of edges of this type

Definition at line 183 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::priority.

Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), and NIImporter_OpenStreetMap::usableType().

◆ getShallBeDiscarded()

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.

Parameters
[in]typeThe id of the type
Returns
Whether edges of this type shall be discarded.

Definition at line 195 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::discard, and getType().

Referenced by NIImporter_OpenDrive::OpenDriveLaneSection::buildLaneMapping(), NIImporter_OpenDrive::findWidthSplit(), NBEdgeCont::ignoreFilterMatch(), and NIImporter_OpenStreetMap::usableType().

◆ getSidewalkWidth()

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

Parameters
[in]typeThe name of the type to return the width for
Returns
The width of lanes of edges of this type

Definition at line 233 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::sidewalkWidth.

Referenced by NIXMLEdgesHandler::addEdge(), NIImporter_OpenStreetMap::insertEdge(), NIXMLTypesHandler::myStartElement(), and NIImporter_OpenStreetMap::usableType().

◆ getSpeed()

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

Parameters
[in]typeThe name of the type to return the speed for
Returns
The allowed speed on edges of this type

Definition at line 177 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(), NIImporter_OpenDrive::setLaneAttributes(), NGNet::toNB(), and NIImporter_OpenStreetMap::usableType().

◆ getType()

const NBTypeCont::TypeDefinition & NBTypeCont::getType ( const std::string &  name) const
private

Retrieve the name or the default type.

If no name is given, the default type is returned

Parameters
[in]nameThe name of the type to retrieve
Returns
The named type

Definition at line 245 of file NBTypeCont.cpp.

References myDefaultType, and myTypes.

Referenced by getBikeLaneWidth(), getIsOneWay(), getMaxWidth(), getMinWidth(), getNumLanes(), getPermissions(), getPriority(), getShallBeDiscarded(), getSidewalkWidth(), getSpeed(), getWidth(), getWidthResolution(), and wasSet().

◆ getWidth()

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

Parameters
[in]typeThe name of the type to return the width for
Returns
The width of lanes of edges of this type

Definition at line 227 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::width.

Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), NIImporter_OpenDrive::setLaneAttributes(), NGNet::toNB(), and NIImporter_OpenStreetMap::usableType().

◆ getWidthResolution()

double NBTypeCont::getWidthResolution ( const std::string &  type) const

Returns the resolution for interpreting edge/lane widths of the given type.

If the named type is not known, the default is returned

Parameters
[in]typeThe name of the type to return the width resolution for
Returns
The width resolution on edges of this type

Definition at line 200 of file NBTypeCont.cpp.

References getType(), and NBTypeCont::TypeDefinition::widthResolution.

Referenced by NIXMLTypesHandler::myStartElement(), and NIImporter_OpenDrive::setLaneAttributes().

◆ insert()

void NBTypeCont::insert ( const std::string &  id,
int  numLanes,
double  maxSpeed,
int  prio,
SVCPermissions  permissions,
double  width,
bool  oneWayIsDefault,
double  sidewalkWidth,
double  bikeLaneWidth,
double  widthResolution,
double  maxWidth,
double  minWidth 
)

Adds a type into the list.

Parameters
[in]idThe id of the type
[in]numLanesThe number of lanes an edge of this type has
[in]maxSpeedThe speed allowed on an edge of this type
[in]prioThe priority of an edge of this type
[in]permissionsThe encoding of vehicle classes allowed on an edge of this type
[in]widthThe width of lanes of edgesof this type
[in]oneWayIsDefaultWhether edges of this type are one-way per default
Returns
Whether the type could be added (no type with the same id existed)

Definition at line 53 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::attrs, myTypes, and NBTypeCont::TypeDefinition::restrictions.

Referenced by NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Types(), and NIImporter_OpenStreetMap::usableType().

◆ knows()

bool NBTypeCont::knows ( const std::string &  type) const

◆ markAsSet()

bool NBTypeCont::markAsSet ( const std::string &  id,
const SumoXMLAttr  attr 
)

Marks an attribute of a type as set.

Parameters
[in]idThe id of the type
[in]attrThe id of the attribute

Definition at line 88 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIXMLTypesHandler::myStartElement(), and NIImporter_VISUM::parse_Types().

◆ markAsToDiscard()

bool NBTypeCont::markAsToDiscard ( const std::string &  id)

Marks a type as to be discarded.

Parameters
[in]idThe id of the type

Definition at line 77 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIXMLTypesHandler::myStartElement().

◆ operator=()

NBTypeCont& NBTypeCont::operator= ( const NBTypeCont s)
private

invalid assignment operator

◆ setDefaults()

void NBTypeCont::setDefaults ( int  defaultNumLanes,
double  defaultLaneWidth,
double  defaultSpeed,
int  defaultPriority,
SVCPermissions  defaultPermissions 
)

Sets the default values.

Parameters
[in]defaultNumLanesThe default number of lanes an edge has
[in]defaultLaneWidthThe default width of lanes
[in]defaultSpeedThe default speed allowed on an edge
[in]defaultPriorityThe default priority of an edge
[in]defaultPermissionsThe default permissions of an edge

Definition at line 39 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().

◆ size()

int NBTypeCont::size ( ) const
inline

Returns the number of known types.

Returns
The number of known edge types (excluding the default)

Definition at line 99 of file NBTypeCont.h.

References myTypes.

Referenced by NILoader::load(), and NWWriter_XML::writeNetwork().

◆ wasSet()

bool NBTypeCont::wasSet ( const std::string &  type,
const SumoXMLAttr  attr 
) const

Returns whether an attribute of a type was set.

Parameters
[in]typeThe id of the type
[in]attrThe id of the attribute
Returns
Whether the attribute was set

Definition at line 215 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::attrs, and getType().

◆ writeTypes()

Field Documentation

◆ myDefaultType

TypeDefinition NBTypeCont::myDefaultType
private

The default type.

Definition at line 337 of file NBTypeCont.h.

Referenced by getType(), and setDefaults().

◆ myTypes

TypesCont NBTypeCont::myTypes
private

The container of types.

Definition at line 343 of file NBTypeCont.h.

Referenced by addRestriction(), copyRestrictionsAndAttrs(), getType(), insert(), knows(), markAsSet(), markAsToDiscard(), size(), and writeTypes().


The documentation for this class was generated from the following files: