SUMO - Simulation of Urban MObility
NBDistrictCont Class Reference

A container for districts. More...

#include <NBDistrictCont.h>

Public Member Functions

bool addSink (const std::string &dist, NBEdge *const destination, SUMOReal weight)
 Adds a sink to the named district.
bool addSource (const std::string &dist, NBEdge *const source, SUMOReal weight)
 Adds a source to the named district.
std::map< std::string,
NBDistrict * >::const_iterator 
begin () const
 Returns the pointer to the begin of the stored districts.
std::map< std::string,
NBDistrict * >::const_iterator 
end () const
 Returns the pointer to the end of the stored districts.
bool insert (NBDistrict *const district)
 Adds a district to the dictionary.
 NBDistrictCont ()
 Constructor.
void removeFromSinksAndSources (NBEdge *const e)
 Removes the given edge from the lists of sources and sinks in all stored districts.
NBDistrictretrieve (const std::string &id) const
 Returns the districts with the given id.
size_t size () const
 Returns the number of districts inside the container.
 ~NBDistrictCont ()
 Destructor.

Private Types

typedef std::map< std::string,
NBDistrict * > 
DistrictCont
 The type of the dictionary where a node may be found by her id.

Private Member Functions

 NBDistrictCont (const NBDistrictCont &s)
NBDistrictContoperator= (const NBDistrictCont &s)

Private Attributes

DistrictCont myDistricts
 The instance of the dictionary.

Detailed Description

A container for districts.

A simple storage for district instances. Allows addition an retrieval of districts, filling them with sources/sinks, and some other methods which operate at all stored districts.

See also:
NBDistrict

Definition at line 60 of file NBDistrictCont.h.


Member Typedef Documentation

typedef std::map<std::string, NBDistrict*> NBDistrictCont::DistrictCont [private]

The type of the dictionary where a node may be found by her id.

Definition at line 151 of file NBDistrictCont.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 48 of file NBDistrictCont.cpp.

Destructor.

Definition at line 51 of file NBDistrictCont.cpp.

References myDistricts.

invalid copy constructor


Member Function Documentation

bool NBDistrictCont::addSink ( const std::string &  dist,
NBEdge *const  destination,
SUMOReal  weight 
)

Adds a sink to the named district.

At first, the district is tried to be retrieved. If this fails, false is returned. Otherwise the retrieved districts NBDistrict::addSink-method is called.

See also:
NBDistrict::addSink
Parameters:
[in]distThe id of the district to add the sink to
[in]sourceAn edge that shall be used as sink
[in]weightAn optional weight of the source
Returns:
Whether the source could be added (the district exists and the suorce was not added to it before)

Definition at line 98 of file NBDistrictCont.cpp.

References NBDistrict::addSink(), and retrieve().

Referenced by NIImporter_VISUM::parse_Connectors().

bool NBDistrictCont::addSource ( const std::string &  dist,
NBEdge *const  source,
SUMOReal  weight 
)

Adds a source to the named district.

At first, the district is tried to be retrieved. If this fails, false is returned. Otherwise the retrieved districts NBDistrict::addSource-method is called.

See also:
NBDistrict::addSource
Parameters:
[in]distThe id of the district to add the source to
[in]sourceAn edge that shall be used as source
[in]weightAn optional weight of the source
Returns:
Whether the source could be added (the district exists and the suorce was not added to it before)

Definition at line 87 of file NBDistrictCont.cpp.

References NBDistrict::addSource(), and retrieve().

Referenced by NIImporter_VISUM::parse_Connectors().

std::map<std::string, NBDistrict*>::const_iterator NBDistrictCont::begin ( ) const [inline]

Returns the pointer to the begin of the stored districts.

Returns:
The iterator to the beginning of stored edges

Definition at line 89 of file NBDistrictCont.h.

References myDistricts.

Referenced by NBNetBuilder::compute(), and NWWriter_SUMO::writeNetwork().

std::map<std::string, NBDistrict*>::const_iterator NBDistrictCont::end ( ) const [inline]

Returns the pointer to the end of the stored districts.

Returns:
The iterator to the end of stored edges

Definition at line 97 of file NBDistrictCont.h.

References myDistricts.

Referenced by NBNetBuilder::compute(), and NWWriter_SUMO::writeNetwork().

bool NBDistrictCont::insert ( NBDistrict *const  district)

Adds a district to the dictionary.

Parameters:
[in]districtThe district to add
Returns:
false if the districts already was in the dictionary

Definition at line 60 of file NBDistrictCont.cpp.

References Named::getID(), and myDistricts.

Referenced by NIVissimDistrictConnection::dict_BuildDistrictNodes(), and NIImporter_VISUM::parse_Districts().

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

invalid assignment operator

Removes the given edge from the lists of sources and sinks in all stored districts.

This method simply goes through all stored districts and calls their method NBDistrict::removeFromSinksAndSources.

See also:
NBDistrict::removeFromSinksAndSources
Parameters:
[in]eThe edge to remove from sinks/sources

Definition at line 109 of file NBDistrictCont.cpp.

References myDistricts.

Referenced by NBEdgeCont::extract().

NBDistrict * NBDistrictCont::retrieve ( const std::string &  id) const

Returns the districts with the given id.

Parameters:
[in]idThe id of the district to retrieve
Returns:
The district with the given id if there was one having it, 0 otherwise

Definition at line 71 of file NBDistrictCont.cpp.

References myDistricts.

Referenced by addSink(), addSource(), NIImporter_VISUM::buildDistrictNode(), and NIVissimDistrictConnection::dict_BuildDistricts().

size_t NBDistrictCont::size ( ) const

Returns the number of districts inside the container.

Definition at line 81 of file NBDistrictCont.cpp.

References myDistricts.

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


Field Documentation

The instance of the dictionary.

Definition at line 154 of file NBDistrictCont.h.

Referenced by begin(), end(), insert(), removeFromSinksAndSources(), retrieve(), size(), and ~NBDistrictCont().


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