SUMO - Simulation of Urban MObility

NBJunctionTypesMatrix.h

Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Definition of a junction's type in dependence
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef NBJunctionTypesMatrix_h
00023 #define NBJunctionTypesMatrix_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <vector>
00036 #include <string>
00037 #include <map>
00038 #include "NBNode.h"
00039 
00040 
00041 // ===========================================================================
00042 // class definitions
00043 // ===========================================================================
00049 class NBJunctionTypesMatrix {
00050 public:
00052     NBJunctionTypesMatrix();
00053 
00055     ~NBJunctionTypesMatrix();
00056 
00059     SumoXMLNodeType getType(SUMOReal speed1, SUMOReal speed2) const;
00060 
00061 private:
00064     char getNameAt(size_t pos1, size_t pos2) const;
00065 
00070     class range_finder {
00071     public:
00073         explicit range_finder(SUMOReal speed) : mySpeed(speed) { }
00074 
00076         bool operator()(const std::pair<SUMOReal, SUMOReal> &range) {
00077             return mySpeed >= range.first && mySpeed < range.second;
00078         }
00079 
00080     private:
00081         SUMOReal mySpeed;
00082     };
00083 
00084 private:
00086     typedef std::vector<std::pair<SUMOReal, SUMOReal> > RangeCont;
00087 
00089     typedef std::vector<std::string> StringCont;
00090 
00092     typedef std::map<char, SumoXMLNodeType> CharToVal;
00093 
00095     RangeCont   myRanges;
00096 
00103     StringCont  myValues;
00104 
00106     CharToVal   myMap;
00107 
00108 };
00109 
00110 
00111 #endif
00112 
00113 /****************************************************************************/
00114 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines