NBTypeCont Class Reference

#include <NBTypeCont.h>


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


Public Member Functions

NBNode::BasicNodeType getJunctionType (SUMOReal speed1, SUMOReal speed2) const throw ()
 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, SUMOVehicleClass vClasses=SVC_UNKNOWN, bool oneWayIsDefault=false) throw ()
 Adds a type into the list.
bool knows (const std::string &type) const throw ()
 Returns whether the named type is in the container.
bool markAsToDiscard (const std::string &id) throw ()
 Marks a type as to be discarded.
 NBTypeCont () throw ()
 Constructor.
void setDefaults (int defaultNoLanes, SUMOReal defaultSpeed, int defaultPriority) throw ()
 Sets the default values.
unsigned int size () const throw ()
 Returns the number of known types.
 ~NBTypeCont () throw ()
 Destructor.
Type-dependant Retrieval methods
const std::vector
< SUMOVehicleClass > & 
getAllowedClasses (const std::string &type) const throw ()
 Returns allowed vehicle classes for the given type.
const std::vector
< SUMOVehicleClass > & 
getDisallowedClasses (const std::string &type) const throw ()
 Returns not allowed vehicle classes for the given type.
bool getIsOneWay (const std::string &type) const throw ()
 Returns whether edges are one-way per default for the given type.
int getNoLanes (const std::string &type) const throw ()
 Returns the number of lanes for the given type.
int getPriority (const std::string &type) const throw ()
 Returns the priority for the given type.
bool getShallBeDiscarded (const std::string &type) const throw ()
 Returns the information whether edges of this type shall be discarded.
SUMOReal getSpeed (const std::string &type) const throw ()
 Returns the maximal velocity for the given type [m/s].
Type-dependant Retrieval methods
int getDefaultNoLanes () throw ()
 Returns the default number of lanes of an edge.
int getDefaultPriority () throw ()
 Returns the default priority of an edge.
SUMOReal getDefaultSpeed () throw ()
 Returns the default speed of an edge.

Private Types

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

Private Member Functions

 NBTypeCont (const NBTypeCont &s)
 invalid copy constructor
NBTypeContoperator= (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.

Data Structures

struct  TypeDefinition

Member Typedef Documentation

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

A container of types, accessed by the string id.

Definition at line 238 of file NBTypeCont.h.


Constructor & Destructor Documentation

NBTypeCont::NBTypeCont (  )  throw () [inline]

Constructor.

Definition at line 55 of file NBTypeCont.h.

00055 {}

NBTypeCont::~NBTypeCont (  )  throw () [inline]

Destructor.

Definition at line 59 of file NBTypeCont.h.

00059 {}

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

invalid copy constructor


Member Function Documentation

const std::vector< SUMOVehicleClass > & NBTypeCont::getAllowedClasses ( const std::string &  type  )  const throw ()

Returns allowed vehicle classes for the given type.

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

Parameters:
[in] type The 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 148 of file NBTypeCont.cpp.

00148                                                                  {
00149     TypesCont::const_iterator i = myTypes.find(type);
00150     if (i==myTypes.end()) {
00151         return myDefaultType.allowed;
00152     }
00153     return (*i).second.allowed;
00154 }

int NBTypeCont::getDefaultNoLanes (  )  throw () [inline]

Returns the default number of lanes of an edge.

Returns:
The number of lanes an edge has per default

Definition at line 185 of file NBTypeCont.h.

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

Referenced by NIImporter_ArcView::load(), NIXMLTypesHandler::myStartElement(), NIXMLEdgesHandler::myStartElement(), and NGNet::toNB().

00185                                     {
00186         return myDefaultType.noLanes;
00187     }

int NBTypeCont::getDefaultPriority (  )  throw () [inline]

Returns the default priority of an edge.

Returns:
The default priority of an edge

Definition at line 201 of file NBTypeCont.h.

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

Referenced by NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), NIXMLEdgesHandler::myStartElement(), and NGNet::toNB().

00201                                      {
00202         return myDefaultType.priority;
00203     }

SUMOReal NBTypeCont::getDefaultSpeed (  )  throw () [inline]

Returns the default speed of an edge.

Returns:
The maximum speed allowed on an edge per default

Definition at line 193 of file NBTypeCont.h.

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

Referenced by NIImporter_ArcView::load(), NIImporter_OpenDrive::loadNetwork(), NIXMLTypesHandler::myStartElement(), NIXMLEdgesHandler::myStartElement(), and NGNet::toNB().

00193                                        {
00194         return myDefaultType.speed;
00195     }

const std::vector< SUMOVehicleClass > & NBTypeCont::getDisallowedClasses ( const std::string &  type  )  const throw ()

Returns not allowed vehicle classes for the given type.

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

Parameters:
[in] type The 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 158 of file NBTypeCont.cpp.

00158                                                                     {
00159     TypesCont::const_iterator i = myTypes.find(type);
00160     if (i==myTypes.end()) {
00161         return myDefaultType.notAllowed;
00162     }
00163     return (*i).second.notAllowed;
00164 }

bool NBTypeCont::getIsOneWay ( const std::string &  type  )  const throw ()

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] type The 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 128 of file NBTypeCont.cpp.

00128                                                            {
00129     TypesCont::const_iterator i = myTypes.find(type);
00130     if (i==myTypes.end()) {
00131         return myDefaultType.oneWay;
00132     }
00133     return (*i).second.oneWay;
00134 }

NBNode::BasicNodeType NBTypeCont::getJunctionType ( SUMOReal  speed1,
SUMOReal  speed2 
) const throw ()

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

Referenced by NBNode::computeType().

00080                                                                           {
00081     return myJunctionTypes.getType(speed1, speed2);
00082 }

int NBTypeCont::getNoLanes ( const std::string &  type  )  const throw ()

Returns the number of lanes for the given type.

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

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

Definition at line 98 of file NBTypeCont.cpp.

Referenced by NIXMLEdgesHandler::myStartElement(), and NIImporter_VISUM::parse_Edges().

00098                                                           {
00099     TypesCont::const_iterator i = myTypes.find(type);
00100     if (i==myTypes.end()) {
00101         return myDefaultType.noLanes;
00102     }
00103     return (*i).second.noLanes;
00104 }

int NBTypeCont::getPriority ( const std::string &  type  )  const throw ()

Returns the priority for the given type.

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

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

Definition at line 118 of file NBTypeCont.cpp.

Referenced by NIXMLEdgesHandler::myStartElement(), and NIImporter_VISUM::parse_Edges().

00118                                                            {
00119     TypesCont::const_iterator i = myTypes.find(type);
00120     if (i==myTypes.end()) {
00121         return myDefaultType.priority;
00122     }
00123     return (*i).second.priority;
00124 }

bool NBTypeCont::getShallBeDiscarded ( const std::string &  type  )  const throw ()

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

Referenced by NBEdgeCont::insert().

00138                                                                    {
00139     TypesCont::const_iterator i = myTypes.find(type);
00140     if (i==myTypes.end()) {
00141         return false;
00142     }
00143     return (*i).second.discard;
00144 }

SUMOReal NBTypeCont::getSpeed ( const std::string &  type  )  const throw ()

Returns the maximal velocity for the given type [m/s].

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

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

Definition at line 108 of file NBTypeCont.cpp.

Referenced by NIXMLEdgesHandler::myStartElement(), and NIImporter_VISUM::parse_Edges().

00108                                                         {
00109     TypesCont::const_iterator i = myTypes.find(type);
00110     if (i==myTypes.end()) {
00111         return myDefaultType.speed;
00112     }
00113     return (*i).second.speed;
00114 }

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

Adds a type into the list.

Parameters:
[in] id The id of the type
[in] noLanes 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] vClasses The vehicle classes allowed on an edge of this type
[in] oneWayIsDefault Whether 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 57 of file NBTypeCont.cpp.

References NBTypeCont::TypeDefinition::allowed, NBTypeCont::TypeDefinition::oneWay, and SVC_UNKNOWN.

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

00058                                                                             {
00059     TypesCont::iterator i = myTypes.find(id);
00060     if (i!=myTypes.end()) {
00061         return false;
00062     }
00063     NBTypeCont::TypeDefinition td(noLanes, maxSpeed, prio);
00064     if (vClasses!=SVC_UNKNOWN) {
00065         td.allowed.push_back(vClasses);
00066     }
00067     td.oneWay = oneWayIsDefault;
00068     myTypes[id] = td;
00069     return true;
00070 }

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

Returns whether the named type is in the container.

Returns:
Whether the named type is known

Definition at line 74 of file NBTypeCont.cpp.

Referenced by NBEdgeCont::insert(), and NIXMLEdgesHandler::myStartElement().

00074                                                      {
00075     return myTypes.find(type)!=myTypes.end();
00076 }

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

Marks a type as to be discarded.

Parameters:
[in] id The id of the type

Definition at line 86 of file NBTypeCont.cpp.

Referenced by NIXMLTypesHandler::myStartElement().

00086                                                        {
00087     TypesCont::iterator i = myTypes.find(id);
00088     if (i==myTypes.end()) {
00089         return false;
00090     }
00091     (*i).second.discard = true;
00092     return true;
00093 }

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

invalid assignment operator

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

Sets the default values.

Parameters:
[in] defaultNoLanes The default number of lanes an edge has
[in] defaultSpeed The default speed allowed on an edge
[in] defaultPriority The default priority of an edge

Definition at line 47 of file NBTypeCont.cpp.

Referenced by NBNetBuilder::applyOptions().

00049                                                      {
00050     myDefaultType.noLanes = defaultNoLanes;
00051     myDefaultType.speed = defaultSpeed;
00052     myDefaultType.priority = defaultPriority;
00053 }

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

Returns the number of known types.

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

Definition at line 87 of file NBTypeCont.h.

References myTypes.

Referenced by NILoader::load().

00087                                       {
00088         return (unsigned int) myTypes.size();
00089     }


Field Documentation

The default type.

Definition at line 235 of file NBTypeCont.h.

Referenced by getDefaultNoLanes(), getDefaultPriority(), and getDefaultSpeed().

The matrix of roads to junction type mappings.

Definition at line 244 of file NBTypeCont.h.

The container of types.

Definition at line 241 of file NBTypeCont.h.

Referenced by size().


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

Generated on Wed May 5 00:06:52 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6