SUMO - Simulation of Urban MObility
NBDistrictCont.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A container for districts
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef NBDistrictCont_h
22 #define NBDistrictCont_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <map>
35 #include <string>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class NBDistrict;
42 class NBEdge;
43 class NBNodeCont;
44 class OutputDevice;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
61 public:
64 
65 
68 
69 
75  bool insert(NBDistrict* const district);
76 
77 
83  NBDistrict* retrieve(const std::string& id) const;
84 
85 
89  std::map<std::string, NBDistrict*>::const_iterator begin() const {
90  return myDistricts.begin();
91  }
92 
93 
97  std::map<std::string, NBDistrict*>::const_iterator end() const {
98  return myDistricts.end();
99  }
100 
101 
103  int size() const;
104 
105 
118  bool addSource(const std::string& dist, NBEdge* const source,
119  double weight);
120 
121 
134  bool addSink(const std::string& dist, NBEdge* const destination,
135  double weight);
136 
137 
146  void removeFromSinksAndSources(NBEdge* const e);
147 
148 
149 private:
151  typedef std::map<std::string, NBDistrict*> DistrictCont;
152 
154  DistrictCont myDistricts;
155 
156 
157 private:
159  NBDistrictCont(const NBDistrictCont& s);
160 
163 
164 
165 };
166 
167 
168 #endif
169 
170 /****************************************************************************/
171 
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:71
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:72
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:71
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:63