00001 /****************************************************************************/ 00007 // A container for routes 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 RODFRouteCont_h 00020 #define RODFRouteCont_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 <map> 00034 #include <utils/common/UtilExceptions.h> 00035 #include "RODFRouteDesc.h" 00036 00037 00038 // =========================================================================== 00039 // class declarations 00040 // =========================================================================== 00041 class RODFNet; 00042 class OutputDevice; 00043 00044 00045 // =========================================================================== 00046 // class definitions 00047 // =========================================================================== 00061 class RODFRouteCont { 00062 public: 00064 RODFRouteCont() throw(); 00065 00067 ~RODFRouteCont() throw(); 00068 00069 00081 void addRouteDesc(RODFRouteDesc &desc) throw(); 00082 00083 00093 bool removeRouteDesc(RODFRouteDesc &desc) throw(); 00094 00095 00104 bool save(std::vector<std::string> &saved, 00105 const std::string &prependix, OutputDevice& out) throw(IOError); 00106 00107 00111 std::vector<RODFRouteDesc> &get() throw() { 00112 return myRoutes; 00113 } 00114 00115 00121 void sortByDistance() throw(); 00122 00123 00131 void removeIllegal(const std::vector<std::vector<ROEdge*> > &illegals) throw(); 00132 00133 00136 void addAllEndFollower() throw(); 00137 00138 00139 protected: 00147 void setID(RODFRouteDesc &desc) const throw(); 00148 00149 00151 class by_distance_sorter { 00152 public: 00154 explicit by_distance_sorter() { } 00155 00157 int operator()(const RODFRouteDesc &p1, const RODFRouteDesc &p2) { 00158 return p1.distance2Last<p2.distance2Last; 00159 } 00160 }; 00161 00162 00164 class route_finder { 00165 public: 00169 explicit route_finder(const RODFRouteDesc &desc) : myDesc(desc) { } 00170 00172 bool operator()(const RODFRouteDesc &desc) { 00173 return myDesc.edges2Pass==desc.edges2Pass; 00174 } 00175 00176 private: 00178 const RODFRouteDesc &myDesc; 00179 00180 }; 00181 00182 protected: 00184 std::vector<RODFRouteDesc> myRoutes; 00185 00187 mutable std::map<std::pair<ROEdge*, ROEdge*>, int> myConnectionOccurences; 00188 00189 00190 }; 00191 00192 00193 #endif 00194 00195 /****************************************************************************/ 00196
1.5.6