SUMO - Simulation of Urban MObility

MS_E2_ZS_CollectorOverLanes.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A detector which joins E2Collectors over consecutive lanes (backward)
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 MS_E2_ZS_CollectorOverLanes_h
00020 #define MS_E2_ZS_CollectorOverLanes_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 <microsim/output/MSDetectorFileOutput.h>
00033 #include <utils/common/UtilExceptions.h>
00034 
00035 
00036 // ===========================================================================
00037 // class declarations
00038 // ===========================================================================
00039 class MSLane;
00040 class SUMOVehicle;
00041 class OutputDevice;
00042 class MSE2Collector;
00043 
00044 
00045 // ===========================================================================
00046 // class definitions
00047 // ===========================================================================
00062 class MS_E2_ZS_CollectorOverLanes :
00063     public MSDetectorFileOutput {
00064 public:
00066     typedef std::vector< MSE2Collector* > CollectorCont;
00067 
00080     MS_E2_ZS_CollectorOverLanes(const std::string& id,
00081                                 DetectorUsage usage, MSLane* lane, SUMOReal startPos,
00082                                 SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
00083                                 SUMOReal jamDistThreshold) throw();
00084 
00085 
00094     void init(MSLane* lane, SUMOReal detLength) throw();
00095 
00096 
00098     virtual ~MS_E2_ZS_CollectorOverLanes() throw();
00099 
00100 
00104     const std::string& getID() const throw();
00105 
00106 
00111     const std::string& getStartLaneID() const throw();
00112 
00113 
00114 
00117 
00126     void writeXMLOutput(OutputDevice& dev,
00127                         SUMOTime startTime, SUMOTime stopTime) throw(IOError);
00128 
00129 
00137     void writeXMLDetectorProlog(OutputDevice& dev) const throw(IOError);
00139 
00140 
00141 
00145     SUMOReal getLength() const  throw() {
00146         return myLength;
00147     }
00148 
00149 protected:
00156     void extendTo(SUMOReal length) throw();
00157 
00158 
00166     std::string  makeID(const std::string& baseID,
00167                         size_t c, size_t r) const throw();
00168 
00169 
00178     virtual MSE2Collector* buildCollector(size_t c, size_t r,
00179                                           MSLane* l, SUMOReal start, SUMOReal end) throw();
00180 
00181 
00187     std::vector<MSLane*> getLanePredeccessorLanes(MSLane* l) throw();
00188 
00189 protected:
00191     SUMOReal startPosM;
00192 
00194     SUMOReal myLength;
00195 
00197     SUMOTime haltingTimeThresholdM;
00198 
00200     SUMOReal haltingSpeedThresholdM;
00201 
00203     SUMOReal jamDistThresholdM;
00204 
00206     typedef std::vector<MSLane*> LaneVector;
00207 
00209     typedef std::vector<LaneVector> LaneVectorVector;
00210 
00212     typedef std::vector<MSE2Collector*> DetectorVector;
00213 
00215     typedef std::vector<DetectorVector> DetectorVectorVector;
00216 
00218     typedef std::vector<SUMOReal> DoubleVector;
00219 
00221     typedef DoubleVector LengthVector;
00222 
00223 
00227     LaneVectorVector myLaneCombinations;
00228 
00229 
00233     DetectorVectorVector myDetectorCombinations;
00234 
00235 
00239     LengthVector myLengths;
00240 
00241 
00243     std::string myID;
00244 
00246     std::string myStartLaneID;
00247 
00249     typedef std::map<MSLane*, MSE2Collector*> LaneDetMap;
00250 
00252     LaneDetMap myAlreadyBuild;
00253 
00255     DetectorUsage myUsage;
00256 
00257 
00258 private:
00260     MS_E2_ZS_CollectorOverLanes(const MS_E2_ZS_CollectorOverLanes&);
00261 
00263     MS_E2_ZS_CollectorOverLanes& operator=(const MS_E2_ZS_CollectorOverLanes&);
00264 
00265 
00266 };
00267 
00268 
00269 #endif
00270 
00271 /****************************************************************************/
00272 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines