SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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. More...
 
bool addSource (const std::string &dist, NBEdge *const source, SUMOReal weight)
 Adds a source to the named district. More...
 
std::map< std::string,
NBDistrict * >::const_iterator 
begin () const
 Returns the pointer to the begin of the stored districts. More...
 
std::map< std::string,
NBDistrict * >::const_iterator 
end () const
 Returns the pointer to the end of the stored districts. More...
 
bool insert (NBDistrict *const district)
 Adds a district to the dictionary. More...
 
 NBDistrictCont ()
 Constructor. More...
 
void removeFromSinksAndSources (NBEdge *const e)
 Removes the given edge from the lists of sources and sinks in all stored districts. More...
 
NBDistrictretrieve (const std::string &id) const
 Returns the districts with the given id. More...
 
size_t size () const
 Returns the number of districts inside the container. More...
 
 ~NBDistrictCont ()
 Destructor. More...
 

Private Types

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

Private Member Functions

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

Private Attributes

DistrictCont myDistricts
 The instance of the dictionary. More...
 

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

NBDistrictCont::NBDistrictCont ( )

Constructor.

Definition at line 48 of file NBDistrictCont.cpp.

NBDistrictCont::~NBDistrictCont ( )

Destructor.

Definition at line 51 of file NBDistrictCont.cpp.

References myDistricts.

NBDistrictCont::NBDistrictCont ( const NBDistrictCont s)
private

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::moveToOrigin(), 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::moveToOrigin(), 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

void NBDistrictCont::removeFromSinksAndSources ( NBEdge *const  e)

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

DistrictCont NBDistrictCont::myDistricts
private

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: