SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // A container for routes 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef RODFRouteCont_h 00022 #define RODFRouteCont_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <vector> 00035 #include <map> 00036 #include <utils/common/UtilExceptions.h> 00037 #include "RODFRouteDesc.h" 00038 00039 00040 // =========================================================================== 00041 // class declarations 00042 // =========================================================================== 00043 class RODFNet; 00044 class OutputDevice; 00045 00046 00047 // =========================================================================== 00048 // class definitions 00049 // =========================================================================== 00063 class RODFRouteCont { 00064 public: 00066 RODFRouteCont() ; 00067 00069 ~RODFRouteCont() ; 00070 00071 00083 void addRouteDesc(RODFRouteDesc& desc) ; 00084 00085 00095 bool removeRouteDesc(RODFRouteDesc& desc) ; 00096 00097 00106 bool save(std::vector<std::string> &saved, 00107 const std::string& prependix, OutputDevice& out); 00108 00109 00113 std::vector<RODFRouteDesc> &get() { 00114 return myRoutes; 00115 } 00116 00117 00123 void sortByDistance() ; 00124 00125 00133 void removeIllegal(const std::vector<std::vector<ROEdge*> > &illegals) ; 00134 00135 00138 void addAllEndFollower() ; 00139 00140 00141 protected: 00149 void setID(RODFRouteDesc& desc) const ; 00150 00151 00153 class by_distance_sorter { 00154 public: 00156 explicit by_distance_sorter() { } 00157 00159 int operator()(const RODFRouteDesc& p1, const RODFRouteDesc& p2) { 00160 return p1.distance2Last < p2.distance2Last; 00161 } 00162 }; 00163 00164 00166 class route_finder { 00167 public: 00171 explicit route_finder(const RODFRouteDesc& desc) : myDesc(desc) { } 00172 00174 bool operator()(const RODFRouteDesc& desc) { 00175 return myDesc.edges2Pass == desc.edges2Pass; 00176 } 00177 00178 private: 00180 const RODFRouteDesc& myDesc; 00181 00182 }; 00183 00184 protected: 00186 std::vector<RODFRouteDesc> myRoutes; 00187 00189 mutable std::map<std::pair<ROEdge*, ROEdge*>, int> myConnectionOccurences; 00190 00191 00192 }; 00193 00194 00195 #endif 00196 00197 /****************************************************************************/ 00198