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 /****************************************************************************/
16 // A container for districts
17 /****************************************************************************/
18 #ifndef NBDistrictCont_h
19 #define NBDistrictCont_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <map>
28 #include <string>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class NBDistrict;
35 class NBEdge;
36 class NBNodeCont;
37 class OutputDevice;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
54 public:
57 
58 
61 
62 
68  bool insert(NBDistrict* const district);
69 
70 
76  NBDistrict* retrieve(const std::string& id) const;
77 
78 
82  std::map<std::string, NBDistrict*>::const_iterator begin() const {
83  return myDistricts.begin();
84  }
85 
86 
90  std::map<std::string, NBDistrict*>::const_iterator end() const {
91  return myDistricts.end();
92  }
93 
94 
96  int size() const;
97 
98 
111  bool addSource(const std::string& dist, NBEdge* const source,
112  double weight);
113 
114 
127  bool addSink(const std::string& dist, NBEdge* const destination,
128  double weight);
129 
130 
139  void removeFromSinksAndSources(NBEdge* const e);
140 
141 
142 private:
144  typedef std::map<std::string, NBDistrict*> DistrictCont;
145 
148 
149 
150 private:
152  NBDistrictCont(const NBDistrictCont& s);
153 
156 
157 
158 };
159 
160 
161 #endif
162 
163 /****************************************************************************/
164 
NBDistrictCont::~NBDistrictCont
~NBDistrictCont()
Destructor.
Definition: NBDistrictCont.cpp:40
NBDistrictCont::begin
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
Definition: NBDistrictCont.h:82
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
NBDistrictCont::retrieve
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
Definition: NBDistrictCont.cpp:60
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:53
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:86
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:76
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:144
NBDistrictCont::myDistricts
DistrictCont myDistricts
The instance of the dictionary.
Definition: NBDistrictCont.h:147
NBDistrictCont::insert
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
Definition: NBDistrictCont.cpp:49
NBDistrictCont::addSink
bool addSink(const std::string &dist, NBEdge *const destination, double weight)
Adds a sink to the named district.
Definition: NBDistrictCont.cpp:87
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:98
NBDistrictCont::end
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
Definition: NBDistrictCont.h:90
NBDistrictCont::NBDistrictCont
NBDistrictCont()
Constructor.
Definition: NBDistrictCont.cpp:37
NBDistrict
A class representing a single district.
Definition: NBDistrict.h:65
NBDistrictCont::size
int size() const
Returns the number of districts inside the container.
Definition: NBDistrictCont.cpp:70