SUMO - Simulation of Urban MObility

MSMeanData_Net.h

Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Network state mean data collector for edges/lanes
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef MSMeanData_Net_h
00023 #define MSMeanData_Net_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <vector>
00036 #include <set>
00037 #include <cassert>
00038 #include <limits>
00039 #include "MSMeanData.h"
00040 
00041 
00042 // ===========================================================================
00043 // class declarations
00044 // ===========================================================================
00045 class OutputDevice;
00046 class MSEdgeControl;
00047 class MSEdge;
00048 class MSLane;
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00065 class MSMeanData_Net : public MSMeanData {
00066 public:
00074     class MSLaneMeanDataValues : public MSMeanData::MeanDataValues {
00075     public:
00079         MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd,
00080                              const std::set<std::string>* const vTypes = 0,
00081                              const MSMeanData_Net* parent = 0) ;
00082 
00084         virtual ~MSLaneMeanDataValues() ;
00085 
00088         void reset(bool afterWrite = false) ;
00089 
00094         void addTo(MSMeanData::MeanDataValues& val) const ;
00095 
00098 
00108         bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) ;
00109 
00110 
00124         bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) ;
00126 
00127         bool isEmpty() const ;
00128 
00136         void write(OutputDevice& dev, const SUMOTime period,
00137                    const SUMOReal numLanes, const int numVehicles = -1) const;
00138 
00139     protected:
00150         void notifyMoveInternal(SUMOVehicle& veh, SUMOReal timeOnLane,
00151                                 SUMOReal speed) ;
00152 
00153     public:
00157         unsigned nVehDeparted;
00158 
00160         unsigned nVehArrived;
00161 
00163         unsigned nVehEntered;
00164 
00166         unsigned nVehLeft;
00167 
00168     private:
00170         unsigned nVehLaneChangeFrom;
00171 
00173         unsigned nVehLaneChangeTo;
00174 
00176         SUMOReal waitSeconds;
00177 
00179         SUMOReal vehLengthSum;
00181 
00183         const MSMeanData_Net* myParent;
00184 
00185     };
00186 
00187 
00188 public:
00203     MSMeanData_Net(const std::string& id,
00204                    const SUMOTime dumpBegin, const SUMOTime dumpEnd,
00205                    const bool useLanes, const bool withEmpty, const bool withInternal,
00206                    const bool trackVehicles,
00207                    const SUMOReal maxTravelTime, const SUMOReal minSamples,
00208                    const SUMOReal haltSpeed, const std::set<std::string> vTypes) ;
00209 
00210 
00212     virtual ~MSMeanData_Net() ;
00213 
00214 protected:
00220     MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const;
00221 
00227     void resetOnly(SUMOTime stopTime) ;
00228 
00229 private:
00231     const SUMOReal myHaltSpeed;
00232 
00234     MSMeanData_Net(const MSMeanData_Net&);
00235 
00237     MSMeanData_Net& operator=(const MSMeanData_Net&);
00238 
00239 };
00240 
00241 
00242 #endif
00243 
00244 /****************************************************************************/
00245 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines