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 SUMOReal defaultTravelTime,
00138                    const int numVehicles = -1) const;
00139 
00140     protected:
00151         void notifyMoveInternal(SUMOVehicle& veh, SUMOReal timeOnLane,
00152                                 SUMOReal speed) ;
00153 
00154     public:
00158         unsigned nVehDeparted;
00159 
00161         unsigned nVehArrived;
00162 
00164         unsigned nVehEntered;
00165 
00167         unsigned nVehLeft;
00168 
00169     private:
00171         unsigned nVehLaneChangeFrom;
00172 
00174         unsigned nVehLaneChangeTo;
00175 
00177         SUMOReal waitSeconds;
00178 
00180         SUMOReal vehLengthSum;
00182 
00184         const MSMeanData_Net* myParent;
00185 
00186     };
00187 
00188 
00189 public:
00205     MSMeanData_Net(const std::string& id,
00206                    const SUMOTime dumpBegin, const SUMOTime dumpEnd,
00207                    const bool useLanes, const bool withEmpty, const bool printDefaults,
00208                    const bool withInternal, const bool trackVehicles,
00209                    const SUMOReal maxTravelTime, const SUMOReal minSamples,
00210                    const SUMOReal haltSpeed, const std::set<std::string> vTypes);
00211 
00212 
00214     virtual ~MSMeanData_Net() ;
00215 
00216 protected:
00222     MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const;
00223 
00229     void resetOnly(SUMOTime stopTime) ;
00230 
00231 private:
00233     const SUMOReal myHaltSpeed;
00234 
00236     MSMeanData_Net(const MSMeanData_Net&);
00237 
00239     MSMeanData_Net& operator=(const MSMeanData_Net&);
00240 
00241 };
00242 
00243 
00244 #endif
00245 
00246 /****************************************************************************/
00247 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines