Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBDistrictCont.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
19// A container for districts
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include <map>
25#include <string>
26
27
28// ===========================================================================
29// class declarations
30// ===========================================================================
31class NBDistrict;
32class NBEdge;
33class NBNodeCont;
34class OutputDevice;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
51public:
54
55
58
59
65 bool insert(NBDistrict* const district);
66
67
73 NBDistrict* retrieve(const std::string& id) const;
74
75
79 std::map<std::string, NBDistrict*>::const_iterator begin() const {
80 return myDistricts.begin();
81 }
82
83
87 std::map<std::string, NBDistrict*>::const_iterator end() const {
88 return myDistricts.end();
89 }
90
91
93 int size() const;
94
95
108 bool addSource(const std::string& dist, NBEdge* const source,
109 double weight);
110
111
124 bool addSink(const std::string& dist, NBEdge* const destination,
125 double weight);
126
127
136 void removeFromSinksAndSources(NBEdge* const e);
137
138
139private:
141 typedef std::map<std::string, NBDistrict*> DistrictCont;
142
145
146
147private:
150
153
154
155};
A container for districts.
NBDistrictCont & operator=(const NBDistrictCont &s)
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
NBDistrictCont()
Constructor.
DistrictCont myDistricts
The instance of the dictionary.
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
bool addSink(const std::string &dist, NBEdge *const destination, double weight)
Adds a sink to the named district.
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
NBDistrictCont(const NBDistrictCont &s)
std::map< std::string, NBDistrict * > DistrictCont
The type of the dictionary where a node may be found by her id.
bool addSource(const std::string &dist, NBEdge *const source, double weight)
Adds a source to the named district.
void removeFromSinksAndSources(NBEdge *const e)
Removes the given edge from the lists of sources and sinks in all stored districts.
int size() const
Returns the number of districts inside the container.
~NBDistrictCont()
Destructor.
A class representing a single district.
Definition NBDistrict.h:62
The representation of a single edge during network building.
Definition NBEdge.h:92
Container for nodes during the netbuilding process.
Definition NBNodeCont.h:57
Static storage of an output device and its base (abstract) implementation.