Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBDistrictCont Class Reference

A container for districts. More...

#include <NBDistrictCont.h>

Public Member Functions

bool addSink (const std::string &dist, NBEdge *const destination, double weight)
 Adds a sink to the named district.
 
bool addSource (const std::string &dist, NBEdge *const source, double 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.
 
int 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 50 of file NBDistrictCont.h.

Member Typedef Documentation

◆ DistrictCont

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 141 of file NBDistrictCont.h.

Constructor & Destructor Documentation

◆ NBDistrictCont() [1/2]

NBDistrictCont::NBDistrictCont ( )

Constructor.

Definition at line 35 of file NBDistrictCont.cpp.

◆ ~NBDistrictCont()

NBDistrictCont::~NBDistrictCont ( )

Destructor.

Definition at line 38 of file NBDistrictCont.cpp.

References myDistricts.

◆ NBDistrictCont() [2/2]

NBDistrictCont::NBDistrictCont ( const NBDistrictCont s)
private

invalid copy constructor

Member Function Documentation

◆ addSink()

bool NBDistrictCont::addSink ( const std::string &  dist,
NBEdge *const  destination,
double  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 85 of file NBDistrictCont.cpp.

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

Referenced by NIImporter_VISUM::parse_Connectors(), and NIImporter_VISUM::parse_Connectors_legacy().

Here is the caller graph for this function:

◆ addSource()

bool NBDistrictCont::addSource ( const std::string &  dist,
NBEdge *const  source,
double  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 74 of file NBDistrictCont.cpp.

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

Referenced by NIImporter_VISUM::parse_Connectors(), and NIImporter_VISUM::parse_Connectors_legacy().

Here is the caller graph for this function:

◆ begin()

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 79 of file NBDistrictCont.h.

References myDistricts.

Referenced by NBNetBuilder::mirrorX(), NBNetBuilder::moveToOrigin(), NWWriter_XML::writeDistricts(), and NWWriter_SUMO::writeNetwork().

Here is the caller graph for this function:

◆ end()

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 87 of file NBDistrictCont.h.

References myDistricts.

Referenced by NBNetBuilder::mirrorX(), NBNetBuilder::moveToOrigin(), NWWriter_XML::writeDistricts(), and NWWriter_SUMO::writeNetwork().

Here is the caller graph for this function:

◆ insert()

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 47 of file NBDistrictCont.cpp.

References Named::getID(), and myDistricts.

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

Here is the caller graph for this function:

◆ operator=()

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

invalid assignment operator

◆ removeFromSinksAndSources()

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 96 of file NBDistrictCont.cpp.

References myDistricts.

Referenced by NBEdgeCont::extract().

Here is the caller graph for this function:

◆ retrieve()

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 58 of file NBDistrictCont.cpp.

References myDistricts.

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

Here is the caller graph for this function:

◆ size()

int NBDistrictCont::size ( ) const

Returns the number of districts inside the container.

Definition at line 68 of file NBDistrictCont.cpp.

References myDistricts.

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

Here is the caller graph for this function:

Field Documentation

◆ myDistricts

DistrictCont NBDistrictCont::myDistricts
private

The instance of the dictionary.

Definition at line 144 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: