|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00011 // A storage for available types of edges 00012 /****************************************************************************/ 00013 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00014 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00015 /****************************************************************************/ 00016 // 00017 // This file is part of SUMO. 00018 // SUMO is free software: you can redistribute it and/or modify 00019 // it under the terms of the GNU General Public License as published by 00020 // the Free Software Foundation, either version 3 of the License, or 00021 // (at your option) any later version. 00022 // 00023 /****************************************************************************/ 00024 #ifndef NBTypeCont_h 00025 #define NBTypeCont_h 00026 00027 00028 // =========================================================================== 00029 // included modules 00030 // =========================================================================== 00031 #ifdef _MSC_VER 00032 #include <windows_config.h> 00033 #else 00034 #include <config.h> 00035 #endif 00036 00037 #include <string> 00038 #include <map> 00039 #include "NBNode.h" 00040 #include "NBJunctionTypesMatrix.h" 00041 #include <utils/common/SUMOVehicleClass.h> 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00057 class NBTypeCont { 00058 public: 00060 NBTypeCont() {} 00061 00062 00064 ~NBTypeCont() {} 00065 00066 00072 void setDefaults(int defaultNoLanes, 00073 SUMOReal defaultSpeed, int defaultPriority) ; 00074 00075 00087 bool insert(const std::string& id, int noLanes, SUMOReal maxSpeed, int prio, 00088 SUMOReal width, SUMOVehicleClass vClasses = SVC_UNKNOWN, bool oneWayIsDefault = false) ; 00089 00101 bool insert(const std::string& id, int noLanes, 00102 SUMOReal maxSpeed, int prio, 00103 const SUMOVehicleClasses& allow, const SUMOVehicleClasses& disallow, 00104 SUMOReal width, bool oneWayIsDefault) ; 00105 00109 unsigned int size() const { 00110 return (unsigned int) myTypes.size(); 00111 } 00112 00113 00117 SumoXMLNodeType getJunctionType(SUMOReal speed1, SUMOReal speed2) const ; 00118 00119 00123 bool knows(const std::string& type) const ; 00124 00125 00129 bool markAsToDiscard(const std::string& id) ; 00130 00131 00132 00135 00142 int getNumLanes(const std::string& type) const ; 00143 00144 00151 SUMOReal getSpeed(const std::string& type) const ; 00152 00153 00160 int getPriority(const std::string& type) const ; 00161 00162 00170 bool getIsOneWay(const std::string& type) const ; 00171 00172 00178 bool getShallBeDiscarded(const std::string& type) const ; 00179 00180 00187 const SUMOVehicleClasses& getAllowedClasses(const std::string& type) const ; 00188 00189 00196 const SUMOVehicleClasses& getDisallowedClasses(const std::string& type) const ; 00197 00198 00205 SUMOReal getWidth(const std::string& type) const ; 00207 00208 00209 private: 00210 struct TypeDefinition { 00212 TypeDefinition() 00213 : noLanes(1), speed((SUMOReal) 13.9), priority(-1), 00214 oneWay(true), discard(false), width(NBEdge::UNSPECIFIED_WIDTH) { } 00215 00217 TypeDefinition(int _noLanes, SUMOReal _speed, int _priority, SUMOReal _width) 00218 : noLanes(_noLanes), speed(_speed), priority(_priority), 00219 oneWay(true), discard(false), width(_width) { } 00220 00222 int noLanes; 00224 SUMOReal speed; 00226 int priority; 00228 SUMOVehicleClasses allowed; 00230 SUMOVehicleClasses notAllowed; 00232 bool oneWay; 00234 bool discard; 00236 SUMOReal width; 00237 00238 }; 00239 00240 00247 const TypeDefinition& getType(const std::string& name) const; 00248 00249 00250 private: 00252 TypeDefinition myDefaultType; 00253 00255 typedef std::map<std::string, TypeDefinition> TypesCont; 00256 00258 TypesCont myTypes; 00259 00261 NBJunctionTypesMatrix myJunctionTypes; 00262 00263 00264 private: 00266 NBTypeCont(const NBTypeCont& s); 00267 00269 NBTypeCont& operator=(const NBTypeCont& s); 00270 00271 00272 }; 00273 00274 00275 #endif 00276 00277 /****************************************************************************/ 00278