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.sourceforge.net/
14 // Copyright (C) 2001-2012 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_UNKNOWN, bool oneWayIsDefault = false);
88 
99  bool insert(const std::string& id, int noLanes,
100  SUMOReal maxSpeed, int prio,
101  SVCPermissions permissions,
102  SUMOReal width, bool oneWayIsDefault);
103 
107  unsigned int size() const {
108  return (unsigned int) myTypes.size();
109  }
110 
111 
115  bool knows(const std::string& type) const;
116 
117 
121  bool markAsToDiscard(const std::string& id);
122 
123 
124 
127 
134  int getNumLanes(const std::string& type) const;
135 
136 
143  SUMOReal getSpeed(const std::string& type) const;
144 
145 
152  int getPriority(const std::string& type) const;
153 
154 
162  bool getIsOneWay(const std::string& type) const;
163 
164 
170  bool getShallBeDiscarded(const std::string& type) const;
171 
172 
179  SVCPermissions getPermissions(const std::string& type) const;
180 
181 
188  SUMOReal getWidth(const std::string& type) const;
190 
191 
192 private:
193  struct TypeDefinition {
196  noLanes(1), speed((SUMOReal) 13.9), priority(-1),
198  oneWay(true), discard(false), width(NBEdge::UNSPECIFIED_WIDTH) { }
199 
201  TypeDefinition(int _noLanes, SUMOReal _speed, int _priority,
202  SUMOReal _width, SVCPermissions _permissions, bool _oneWay) :
203  noLanes(_noLanes), speed(_speed), priority(_priority),
204  permissions(_permissions),
205  oneWay(_oneWay), discard(false), width(_width) { }
206 
208  int noLanes;
212  int priority;
216  bool oneWay;
218  bool discard;
221 
222  };
223 
224 
231  const TypeDefinition& getType(const std::string& name) const;
232 
233 
234 private:
237 
239  typedef std::map<std::string, TypeDefinition> TypesCont;
240 
243 
244 
245 private:
247  NBTypeCont(const NBTypeCont& s);
248 
250  NBTypeCont& operator=(const NBTypeCont& s);
251 
252 
253 };
254 
255 
256 #endif
257 
258 /****************************************************************************/
259