SUMO - Simulation of Urban MObility

NBTypeCont Class Reference

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

#include <NBTypeCont.h>

Data Structures

struct  TypeDefinition

Public Member Functions

SumoXMLNodeType getJunctionType (SUMOReal speed1, SUMOReal speed2) const
 Returns the type of the junction between two edges of the given types.
bool insert (const std::string &id, int noLanes, SUMOReal maxSpeed, int prio, const SUMOVehicleClasses &allow, const SUMOVehicleClasses &disallow, SUMOReal width, bool oneWayIsDefault)
 Adds a type into the list.
bool insert (const std::string &id, int noLanes, SUMOReal maxSpeed, int prio, SUMOReal width, SUMOVehicleClass vClasses=SVC_UNKNOWN, bool oneWayIsDefault=false)
 Adds a type into the list. This is a simplified convenience form of insert, if only one allowed vehicle class is necessary.
bool knows (const std::string &type) const
 Returns whether the named type is in the container.
bool markAsToDiscard (const std::string &id)
 Marks a type as to be discarded.
 NBTypeCont ()
 Constructor.
void setDefaults (int defaultNoLanes, SUMOReal defaultSpeed, int defaultPriority)
 Sets the default values.
unsigned int size () const
 Returns the number of known types.
 ~NBTypeCont ()
 Destructor.
Type-dependant Retrieval methods
int getNumLanes (const std::string &type) const
 Returns the number of lanes for the given type.
SUMOReal getSpeed (const std::string &type) const
 Returns the maximal velocity for the given type [m/s].
int getPriority (const std::string &type) const
 Returns the priority for the given type.
bool getIsOneWay (const std::string &type) const
 Returns whether edges are one-way per default for the given type.
bool getShallBeDiscarded (const std::string &type) const
 Returns the information whether edges of this type shall be discarded.
const SUMOVehicleClasses & getAllowedClasses (const std::string &type) const
 Returns allowed vehicle classes for the given type.
const SUMOVehicleClasses & getDisallowedClasses (const std::string &type) const
 Returns not allowed vehicle classes for the given type.
SUMOReal getWidth (const std::string &type) const
 Returns the lane width for the given type [m/s].

Private Types

typedef std::map< std::string,
TypeDefinition > 
TypesCont
 A container of types, accessed by the string id.

Private Member Functions

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

Private Attributes

TypeDefinition myDefaultType
 The default type.
NBJunctionTypesMatrix myJunctionTypes
 The matrix of roads to junction type mappings.
TypesCont myTypes
 The container of types.

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


Member Typedef Documentation

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

A container of types, accessed by the string id.

Definition at line 255 of file NBTypeCont.h.


Constructor & Destructor Documentation

NBTypeCont::NBTypeCont ( ) [inline]

Constructor.

Definition at line 60 of file NBTypeCont.h.

NBTypeCont::~NBTypeCont ( ) [inline]

Destructor.

Definition at line 64 of file NBTypeCont.h.

NBTypeCont::NBTypeCont ( const NBTypeCont &  s) [private]

invalid copy constructor


Member Function Documentation

const SUMOVehicleClasses & NBTypeCont::getAllowedClasses ( 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 143 of file NBTypeCont.cpp.

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

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

const SUMOVehicleClasses & NBTypeCont::getDisallowedClasses ( const std::string &  type) const

Returns not 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 not allowed vehicles classes for
Returns:
List of vehicles class which may not use edges of the given type

Definition at line 149 of file NBTypeCont.cpp.

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

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

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 131 of file NBTypeCont.cpp.

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

Referenced by NIImporter_OpenStreetMap::insertEdge().

SumoXMLNodeType NBTypeCont::getJunctionType ( SUMOReal  speed1,
SUMOReal  speed2 
) const

Returns the type of the junction between two edges of the given types.

Returns:
The node type for two edges havnig the given speeds

Definition at line 95 of file NBTypeCont.cpp.

References NBJunctionTypesMatrix::getType(), and myJunctionTypes.

Referenced by NBNode::computeType().

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 113 of file NBTypeCont.cpp.

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

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

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 125 of file NBTypeCont.cpp.

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

Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), 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.

Returns:
Whether edges of this type shall be discarded.

Definition at line 137 of file NBTypeCont.cpp.

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

Referenced by NBEdgeCont::ignoreFilterMatch().

SUMOReal 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 119 of file NBTypeCont.cpp.

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

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

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 161 of file NBTypeCont.cpp.

References myDefaultType, and myTypes.

Referenced by getAllowedClasses(), getDisallowedClasses(), getIsOneWay(), getNumLanes(), getPriority(), getShallBeDiscarded(), getSpeed(), and getWidth().

SUMOReal NBTypeCont::getWidth ( const std::string &  type) const

Returns the lane width 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 width for
Returns:
The width of lanes of edges of this type

Definition at line 155 of file NBTypeCont.cpp.

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

Referenced by NIXMLEdgesHandler::addEdge(), NGEdge::buildNBEdge(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), and NGNet::toNB().

bool NBTypeCont::insert ( const std::string &  id,
int  noLanes,
SUMOReal  maxSpeed,
int  prio,
SUMOReal  width,
SUMOVehicleClass  vClasses = SVC_UNKNOWN,
bool  oneWayIsDefault = false 
)

Adds a type into the list. This is a simplified convenience form of insert, if only one allowed vehicle class is necessary.

Parameters:
[in]idThe id of the type
[in]noLanesThe 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]widthThe width of lanes of edgesof this type
[in]vClassesThe vehicle classes allowed on an edge of 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 61 of file NBTypeCont.cpp.

References SVC_UNKNOWN.

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

bool NBTypeCont::insert ( const std::string &  id,
int  noLanes,
SUMOReal  maxSpeed,
int  prio,
const SUMOVehicleClasses &  allow,
const SUMOVehicleClasses &  disallow,
SUMOReal  width,
bool  oneWayIsDefault 
)

Adds a type into the list.

Parameters:
[in]idThe id of the type
[in]noLanesThe 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]allowThe list of vehicle classes allowed on an edge of this type
[in]disallowThe list of vehicle classes disallowed 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 72 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::allowed, myTypes, NBTypeCont::TypeDefinition::notAllowed, and NBTypeCont::TypeDefinition::oneWay.

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

Returns whether the named type is in the container.

Returns:
Whether the named type is known

Definition at line 89 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIXMLEdgesHandler::addEdge(), NBEdgeCont::ignoreFilterMatch(), and NIImporter_OpenStreetMap::insertEdge().

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

Marks a type as to be discarded.

Parameters:
[in]idThe id of the type

Definition at line 101 of file NBTypeCont.cpp.

References myTypes.

Referenced by NIXMLTypesHandler::myStartElement().

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

invalid assignment operator

void NBTypeCont::setDefaults ( int  defaultNoLanes,
SUMOReal  defaultSpeed,
int  defaultPriority 
)

Sets the default values.

Parameters:
[in]defaultNoLanesThe default number of lanes an edge has
[in]defaultSpeedThe default speed allowed on an edge
[in]defaultPriorityThe default priority of an edge

Definition at line 51 of file NBTypeCont.cpp.

References myDefaultType, NBTypeCont::TypeDefinition::noLanes, NBTypeCont::TypeDefinition::priority, and NBTypeCont::TypeDefinition::speed.

Referenced by NBNetBuilder::applyOptions().

unsigned int NBTypeCont::size ( ) const [inline]

Returns the number of known types.

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

Definition at line 109 of file NBTypeCont.h.

References myTypes.

Referenced by NILoader::load().


Field Documentation

The default type.

Definition at line 252 of file NBTypeCont.h.

Referenced by getType(), and setDefaults().

The matrix of roads to junction type mappings.

Definition at line 261 of file NBTypeCont.h.

Referenced by getJunctionType().

The container of types.

Definition at line 258 of file NBTypeCont.h.

Referenced by getType(), insert(), knows(), markAsToDiscard(), and size().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines