NBJunctionTypesMatrix.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Definition of a junction's type in dependence
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 NBJunctionTypesMatrix_h
00020 #define NBJunctionTypesMatrix_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 <vector>
00033 #include <string>
00034 #include <map>
00035 #include "NBNode.h"
00036 
00037 
00038 // ===========================================================================
00039 // class definitions
00040 // ===========================================================================
00046 class NBJunctionTypesMatrix {
00047 public:
00049     NBJunctionTypesMatrix();
00050 
00052     ~NBJunctionTypesMatrix();
00053 
00056     NBNode::BasicNodeType getType(SUMOReal speed1, SUMOReal speed2) const;
00057 
00058 private:
00061     char getNameAt(size_t pos1, size_t pos2) const;
00062 
00067     class range_finder {
00068     public:
00070         explicit range_finder(SUMOReal speed) : mySpeed(speed) { }
00071 
00073         bool operator()(const std::pair<SUMOReal, SUMOReal> &range) {
00074             return mySpeed>=range.first && mySpeed<range.second;
00075         }
00076 
00077     private:
00078         SUMOReal mySpeed;
00079     };
00080 
00081 private:
00083     typedef std::vector<std::pair<SUMOReal, SUMOReal> > RangeCont;
00084 
00086     typedef std::vector<std::string> StringCont;
00087 
00089     typedef std::map<char, NBNode::BasicNodeType> CharToVal;
00090 
00092     RangeCont   myRanges;
00093 
00100     StringCont  myValues;
00101 
00103     CharToVal   myMap;
00104 
00105 };
00106 
00107 
00108 #endif
00109 
00110 /****************************************************************************/
00111 

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