SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBTypeCont.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // A storage for available types of edges
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
14 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef NBTypeCont_h
25 #define NBTypeCont_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <string>
38 #include <map>
39 #include "NBNode.h"
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
56 class NBTypeCont {
57 public:
60 
61 
64 
65 
71  void setDefaults(int defaultNoLanes,
72  SUMOReal defaultSpeed, int defaultPriority);
73 
74 
86  bool insert(const std::string& id, int noLanes, SUMOReal maxSpeed, int prio,
87  SUMOReal width, SUMOVehicleClass vClasses = SVC_IGNORING, bool oneWayIsDefault = false,
88  SUMOReal sidewalkWidth = NBEdge::UNSPECIFIED_WIDTH);
89 
100  bool insert(const std::string& id, int noLanes,
101  SUMOReal maxSpeed, int prio,
102  SVCPermissions permissions,
103  SUMOReal width, bool oneWayIsDefault,
104  SUMOReal sidewalkWidth);
105 
109  unsigned int size() const {
110  return (unsigned int) myTypes.size();
111  }
112 
113 
117  bool knows(const std::string& type) const;
118 
119 
123  bool markAsToDiscard(const std::string& id);
124 
125 
126 
129 
136  int getNumLanes(const std::string& type) const;
137 
138 
145  SUMOReal getSpeed(const std::string& type) const;
146 
147 
154  int getPriority(const std::string& type) const;
155 
156 
164  bool getIsOneWay(const std::string& type) const;
165 
166 
172  bool getShallBeDiscarded(const std::string& type) const;
173 
174 
181  SVCPermissions getPermissions(const std::string& type) const;
182 
183 
190  SUMOReal getWidth(const std::string& type) const;
191 
192 
199  SUMOReal getSidewalkWidth(const std::string& type) const;
201 
202 
203 private:
204  struct TypeDefinition {
207  noLanes(1), speed((SUMOReal) 13.9), priority(-1),
209  oneWay(true), discard(false),
210  width(NBEdge::UNSPECIFIED_WIDTH),
211  sidewalkWidth(NBEdge::UNSPECIFIED_WIDTH)
212  { }
213 
215  TypeDefinition(int _noLanes, SUMOReal _speed, int _priority,
216  SUMOReal _width, SVCPermissions _permissions, bool _oneWay,
217  SUMOReal _sideWalkWidth) :
218  noLanes(_noLanes), speed(_speed), priority(_priority),
219  permissions(_permissions),
220  oneWay(_oneWay), discard(false), width(_width),
221  sidewalkWidth(_sideWalkWidth)
222  { }
223 
225  int noLanes;
229  int priority;
233  bool oneWay;
235  bool discard;
238  /* @brief The width of the sidewalk that should be added as an additional lane
239  * a value of NBEdge::UNSPECIFIED_WIDTH indicates that no sidewalk should be added */
241 
242  };
243 
244 
251  const TypeDefinition& getType(const std::string& name) const;
252 
253 
254 private:
257 
259  typedef std::map<std::string, TypeDefinition> TypesCont;
260 
263 
264 
265 private:
267  NBTypeCont(const NBTypeCont& s);
268 
270  NBTypeCont& operator=(const NBTypeCont& s);
271 
272 
273 };
274 
275 
276 #endif
277 
278 /****************************************************************************/
279