SUMO - Simulation of Urban MObility

MSEdgeControl.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Stores edges and lanes, performs moving of vehicle
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 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 <utils/common/SUMOTime.h>
00039 #include <utils/common/Named.h>
00040 
00041 
00042 // ===========================================================================
00043 // class declarations
00044 // ===========================================================================
00045 class MSEdge;
00046 class MSLane;
00047 class OutputDevice;
00048 class BinaryInputDevice;
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00068 class MSEdgeControl {
00069 public:
00071     typedef std::vector< MSEdge* > EdgeCont;
00072 
00073 public:
00081     MSEdgeControl(const std::vector< MSEdge* > &edges) throw();
00082 
00083 
00085     ~MSEdgeControl() throw();
00086 
00087 
00094     void patchActiveLanes() throw();
00095 
00096 
00099 
00112     void moveCritical(SUMOTime t) throw();
00113 
00114 
00133     void moveFirst(SUMOTime t) throw();
00135 
00136 
00145     void changeLanes(SUMOTime t) throw();
00146 
00147 
00156     void detectCollisions(SUMOTime timestep) throw();
00157 
00158 
00164     const std::vector<MSEdge*> &getEdges() const throw() {
00165         return myEdges;
00166     }
00167 
00168 
00173     std::vector<std::string> getEdgeNames() const throw();
00174 
00175 
00181     void gotActive(MSLane* l) throw();
00182 
00183 
00184 public:
00196     struct LaneUsage {
00198         MSLane* lane;
00200         std::vector<MSLane*>::const_iterator firstNeigh;
00202         std::vector<MSLane*>::const_iterator lastNeigh;
00204         bool amActive;
00206         bool haveNeighbors;
00207     };
00208 
00209 private:
00211     std::vector<MSEdge*> myEdges;
00212 
00214     typedef std::vector<LaneUsage> LaneUsageVector;
00215 
00217     LaneUsageVector myLanes;
00218 
00220     std::list<MSLane*> myActiveLanes;
00221 
00223     std::vector<MSLane*> myWithVehicles2Integrate;
00224 
00226     std::set<MSLane*, Named::ComparatorIdLess> myChangedStateLanes;
00227 
00229     std::vector<SUMOTime> myLastLaneChange;
00230 
00231 private:
00233     MSEdgeControl(const MSEdgeControl&);
00234 
00236     MSEdgeControl& operator=(const MSEdgeControl&);
00237 
00238 };
00239 
00240 
00241 #endif
00242 
00243 /****************************************************************************/
00244 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines