Eclipse SUMO - Simulation of Urban MObility
NBDistrictCont.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A container for districts
16 /****************************************************************************/
17 #ifndef NBDistrictCont_h
18 #define NBDistrictCont_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <map>
27 #include <string>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class NBDistrict;
34 class NBEdge;
35 class NBNodeCont;
36 class OutputDevice;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
53 public:
56 
57 
60 
61 
67  bool insert(NBDistrict* const district);
68 
69 
75  NBDistrict* retrieve(const std::string& id) const;
76 
77 
81  std::map<std::string, NBDistrict*>::const_iterator begin() const {
82  return myDistricts.begin();
83  }
84 
85 
89  std::map<std::string, NBDistrict*>::const_iterator end() const {
90  return myDistricts.end();
91  }
92 
93 
95  int size() const;
96 
97 
110  bool addSource(const std::string& dist, NBEdge* const source,
111  double weight);
112 
113 
126  bool addSink(const std::string& dist, NBEdge* const destination,
127  double weight);
128 
129 
138  void removeFromSinksAndSources(NBEdge* const e);
139 
140 
141 private:
143  typedef std::map<std::string, NBDistrict*> DistrictCont;
144 
147 
148 
149 private:
151  NBDistrictCont(const NBDistrictCont& s);
152 
155 
156 
157 };
158 
159 
160 #endif
161 
162 /****************************************************************************/
163 
NBDistrictCont::~NBDistrictCont
~NBDistrictCont()
Destructor.
Definition: NBDistrictCont.cpp:39
NBDistrictCont::begin
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
Definition: NBDistrictCont.h:81
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
NBDistrictCont::retrieve
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
Definition: NBDistrictCont.cpp:59
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:52
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:59
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NBDistrictCont::operator=
NBDistrictCont & operator=(const NBDistrictCont &s)
NBDistrictCont::addSource
bool addSource(const std::string &dist, NBEdge *const source, double weight)
Adds a source to the named district.
Definition: NBDistrictCont.cpp:75
NBDistrictCont::DistrictCont
std::map< std::string, NBDistrict * > DistrictCont
The type of the dictionary where a node may be found by her id.
Definition: NBDistrictCont.h:143
NBDistrictCont::myDistricts
DistrictCont myDistricts
The instance of the dictionary.
Definition: NBDistrictCont.h:146
NBDistrictCont::insert
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
Definition: NBDistrictCont.cpp:48
NBDistrictCont::addSink
bool addSink(const std::string &dist, NBEdge *const destination, double weight)
Adds a sink to the named district.
Definition: NBDistrictCont.cpp:86
config.h
NBDistrictCont::removeFromSinksAndSources
void removeFromSinksAndSources(NBEdge *const e)
Removes the given edge from the lists of sources and sinks in all stored districts.
Definition: NBDistrictCont.cpp:97
NBDistrictCont::end
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
Definition: NBDistrictCont.h:89
NBDistrictCont::NBDistrictCont
NBDistrictCont()
Constructor.
Definition: NBDistrictCont.cpp:36
NBDistrict
A class representing a single district.
Definition: NBDistrict.h:64
NBDistrictCont::size
int size() const
Returns the number of districts inside the container.
Definition: NBDistrictCont.cpp:69