00001 /****************************************************************************/ 00007 // Stores edges and lanes, performs moving of vehicle 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 MSEdgeControl_h 00020 #define MSEdgeControl_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 <string> 00035 #include <iostream> 00036 #include <list> 00037 #include <set> 00038 #include "MSEdge.h" 00039 00040 00041 // =========================================================================== 00042 // class declarations 00043 // =========================================================================== 00044 class OutputDevice; 00045 class BinaryInputDevice; 00046 00047 00048 // =========================================================================== 00049 // class definitions 00050 // =========================================================================== 00065 class MSEdgeControl { 00066 public: 00068 typedef std::vector< MSEdge* > EdgeCont; 00069 00070 public: 00078 MSEdgeControl(const std::vector< MSEdge* > &edges) throw(); 00079 00080 00082 ~MSEdgeControl() throw(); 00083 00084 00091 void patchActiveLanes() throw(); 00092 00093 00096 00109 void moveCritical(SUMOTime t) throw(); 00110 00111 00130 void moveFirst(SUMOTime t) throw(); 00132 00133 00142 void changeLanes(SUMOTime t) throw(); 00143 00144 00153 void detectCollisions(SUMOTime timestep) throw(); 00154 00155 00161 const std::vector<MSEdge*> &getEdges() const throw() { 00162 return myEdges; 00163 } 00164 00165 00170 std::vector<std::string> getEdgeNames() const throw(); 00171 00172 00178 void gotActive(MSLane *l) throw(); 00179 00180 00181 public: 00193 struct LaneUsage { 00195 MSLane *lane; 00197 std::vector<MSLane*>::const_iterator firstNeigh; 00199 std::vector<MSLane*>::const_iterator lastNeigh; 00201 bool amActive; 00203 bool haveNeighbors; 00204 }; 00205 00206 private: 00208 std::vector<MSEdge*> myEdges; 00209 00211 typedef std::vector<LaneUsage> LaneUsageVector; 00212 00214 LaneUsageVector myLanes; 00215 00217 std::list<MSLane*> myActiveLanes; 00218 00220 std::vector<MSLane*> myWithVehicles2Integrate; 00221 00223 std::set<MSLane*> myChangedStateLanes; 00224 00226 std::vector<SUMOTime> myLastLaneChange; 00227 00228 private: 00230 MSEdgeControl(const MSEdgeControl&); 00231 00233 MSEdgeControl& operator=(const MSEdgeControl&); 00234 00235 }; 00236 00237 00238 #endif 00239 00240 /****************************************************************************/ 00241
1.5.6