SUMO - Simulation of Urban MObility
MSEdgeControl.h
Go to the documentation of this file.
00001 /****************************************************************************/
00012 // Stores edges and lanes, performs moving of vehicle
00013 /****************************************************************************/
00014 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00015 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00016 /****************************************************************************/
00017 //
00018 //   This file is part of SUMO.
00019 //   SUMO is free software: you can redistribute it and/or modify
00020 //   it under the terms of the GNU General Public License as published by
00021 //   the Free Software Foundation, either version 3 of the License, or
00022 //   (at your option) any later version.
00023 //
00024 /****************************************************************************/
00025 #ifndef MSEdgeControl_h
00026 #define MSEdgeControl_h
00027 
00028 
00029 // ===========================================================================
00030 // included modules
00031 // ===========================================================================
00032 #ifdef _MSC_VER
00033 #include <windows_config.h>
00034 #else
00035 #include <config.h>
00036 #endif
00037 
00038 #include <vector>
00039 #include <map>
00040 #include <string>
00041 #include <iostream>
00042 #include <list>
00043 #include <set>
00044 #include <utils/common/SUMOTime.h>
00045 #include <utils/common/Named.h>
00046 
00047 
00048 // ===========================================================================
00049 // class declarations
00050 // ===========================================================================
00051 class MSEdge;
00052 class MSLane;
00053 class OutputDevice;
00054 class BinaryInputDevice;
00055 
00056 
00057 // ===========================================================================
00058 // class definitions
00059 // ===========================================================================
00074 class MSEdgeControl {
00075 public:
00077     typedef std::vector< MSEdge* > EdgeCont;
00078 
00079 public:
00087     MSEdgeControl(const std::vector< MSEdge* > &edges) ;
00088 
00089 
00091     ~MSEdgeControl() ;
00092 
00093 
00100     void patchActiveLanes() ;
00101 
00102 
00105 
00118     void moveCritical(SUMOTime t) ;
00119 
00120 
00139     void moveFirst(SUMOTime t) ;
00141 
00142 
00151     void changeLanes(SUMOTime t) ;
00152 
00153 
00162     void detectCollisions(SUMOTime timestep) ;
00163 
00164 
00170     const std::vector<MSEdge*> &getEdges() const {
00171         return myEdges;
00172     }
00173 
00174 
00179     std::vector<std::string> getEdgeNames() const ;
00180 
00181 
00187     void gotActive(MSLane* l) ;
00188 
00189 
00190 public:
00202     struct LaneUsage {
00204         MSLane* lane;
00206         std::vector<MSLane*>::const_iterator firstNeigh;
00208         std::vector<MSLane*>::const_iterator lastNeigh;
00210         bool amActive;
00212         bool haveNeighbors;
00213     };
00214 
00215 private:
00217     std::vector<MSEdge*> myEdges;
00218 
00220     typedef std::vector<LaneUsage> LaneUsageVector;
00221 
00223     LaneUsageVector myLanes;
00224 
00226     std::list<MSLane*> myActiveLanes;
00227 
00229     std::vector<MSLane*> myWithVehicles2Integrate;
00230 
00232     std::set<MSLane*, Named::ComparatorIdLess> myChangedStateLanes;
00233 
00235     std::vector<SUMOTime> myLastLaneChange;
00236 
00237 private:
00239     MSEdgeControl(const MSEdgeControl&);
00240 
00242     MSEdgeControl& operator=(const MSEdgeControl&);
00243 
00244 };
00245 
00246 
00247 #endif
00248 
00249 /****************************************************************************/
00250 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines