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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A container for districts
19 /****************************************************************************/
20 #ifndef NBDistrictCont_h
21 #define NBDistrictCont_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <map>
34 #include <string>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class NBDistrict;
41 class NBEdge;
42 class NBNodeCont;
43 class OutputDevice;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
60 public:
63 
64 
67 
68 
74  bool insert(NBDistrict* const district);
75 
76 
82  NBDistrict* retrieve(const std::string& id) const;
83 
84 
88  std::map<std::string, NBDistrict*>::const_iterator begin() const {
89  return myDistricts.begin();
90  }
91 
92 
96  std::map<std::string, NBDistrict*>::const_iterator end() const {
97  return myDistricts.end();
98  }
99 
100 
102  int size() const;
103 
104 
117  bool addSource(const std::string& dist, NBEdge* const source,
118  double weight);
119 
120 
133  bool addSink(const std::string& dist, NBEdge* const destination,
134  double weight);
135 
136 
145  void removeFromSinksAndSources(NBEdge* const e);
146 
147 
148 private:
150  typedef std::map<std::string, NBDistrict*> DistrictCont;
151 
153  DistrictCont myDistricts;
154 
155 
156 private:
158  NBDistrictCont(const NBDistrictCont& s);
159 
162 
163 
164 };
165 
166 
167 #endif
168 
169 /****************************************************************************/
170 
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
The representation of a single edge during network building.
Definition: NBEdge.h:70
A container for districts.
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
DistrictCont myDistricts
The instance of the dictionary.
A class representing a single district.
Definition: NBDistrict.h:71
bool addSource(const std::string &dist, NBEdge *const source, double weight)
Adds a source to the named district.
~NBDistrictCont()
Destructor.
bool addSink(const std::string &dist, NBEdge *const destination, double weight)
Adds a sink to the named district.
NBDistrictCont & operator=(const NBDistrictCont &s)
int size() const
Returns the number of districts inside the container.
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
std::map< std::string, NBDistrict * > DistrictCont
The type of the dictionary where a node may be found by her id.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
NBDistrictCont()
Constructor.
void removeFromSinksAndSources(NBEdge *const e)
Removes the given edge from the lists of sources and sinks in all stored districts.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:66