NBTypeCont.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A storage for available types of edges
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef NBTypeCont_h
00020 #define NBTypeCont_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <map>
00034 #include "NBNode.h"
00035 #include "NBJunctionTypesMatrix.h"
00036 #include <utils/common/SUMOVehicleClass.h>
00037 
00038 
00039 // ===========================================================================
00040 // class definitions
00041 // ===========================================================================
00052 class NBTypeCont {
00053 public:
00055     NBTypeCont() throw() {}
00056 
00057 
00059     ~NBTypeCont() throw() {}
00060 
00061 
00067     void setDefaults(int defaultNoLanes,
00068                      SUMOReal defaultSpeed, int defaultPriority) throw();
00069 
00070 
00080     bool insert(const std::string &id, int noLanes, SUMOReal maxSpeed, int prio,
00081                 SUMOVehicleClass vClasses=SVC_UNKNOWN, bool oneWayIsDefault=false) throw();
00082 
00083 
00087     unsigned int size() const throw() {
00088         return (unsigned int) myTypes.size();
00089     }
00090 
00091 
00095     NBNode::BasicNodeType getJunctionType(SUMOReal speed1, SUMOReal speed2) const throw();
00096 
00097 
00101     bool knows(const std::string &type) const throw();
00102 
00103 
00107     bool markAsToDiscard(const std::string &id) throw();
00108 
00109 
00110 
00113 
00120     int getNoLanes(const std::string &type) const throw();
00121 
00122 
00129     SUMOReal getSpeed(const std::string &type) const throw();
00130 
00131 
00138     int getPriority(const std::string &type) const throw();
00139 
00140 
00148     bool getIsOneWay(const std::string &type) const throw();
00149 
00150 
00156     bool getShallBeDiscarded(const std::string &type) const throw();
00157 
00158 
00165     const std::vector<SUMOVehicleClass> &getAllowedClasses(const std::string &type) const throw();
00166 
00167 
00174     const std::vector<SUMOVehicleClass> &getDisallowedClasses(const std::string &type) const throw();
00176 
00177 
00178 
00181 
00185     int getDefaultNoLanes() throw() {
00186         return myDefaultType.noLanes;
00187     }
00188 
00189 
00193     SUMOReal getDefaultSpeed() throw() {
00194         return myDefaultType.speed;
00195     }
00196 
00197 
00201     int getDefaultPriority() throw() {
00202         return myDefaultType.priority;
00203     }
00205 
00206 
00207 private:
00208     struct TypeDefinition {
00210         TypeDefinition()
00211                 : noLanes(1), speed((SUMOReal) 13.9), priority(-1), oneWay(true), discard(false) { }
00212 
00214         TypeDefinition(int _noLanes, SUMOReal _speed, int _priority)
00215                 : noLanes(_noLanes), speed(_speed), priority(_priority), oneWay(true), discard(false) { }
00216 
00218         int noLanes;
00220         SUMOReal speed;
00222         int priority;
00224         std::vector<SUMOVehicleClass> allowed;
00226         std::vector<SUMOVehicleClass> notAllowed;
00228         bool oneWay;
00230         bool discard;
00231 
00232     };
00233 
00235     TypeDefinition myDefaultType;
00236 
00238     typedef std::map<std::string, TypeDefinition> TypesCont;
00239 
00241     TypesCont myTypes;
00242 
00244     NBJunctionTypesMatrix myJunctionTypes;
00245 
00246 
00247 private:
00249     NBTypeCont(const NBTypeCont &s);
00250 
00252     NBTypeCont &operator=(const NBTypeCont &s);
00253 
00254 
00255 };
00256 
00257 
00258 #endif
00259 
00260 /****************************************************************************/
00261 

Generated on Wed May 5 00:06:33 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6