SUMO - Simulation of Urban MObility

MSMeanData_Net.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Network state mean data collector for edges/lanes
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 MSMeanData_Net_h
00020 #define MSMeanData_Net_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 <set>
00034 #include <cassert>
00035 #include <limits>
00036 #include "MSMeanData.h"
00037 
00038 
00039 // ===========================================================================
00040 // class declarations
00041 // ===========================================================================
00042 class OutputDevice;
00043 class MSEdgeControl;
00044 class MSEdge;
00045 class MSLane;
00046 
00047 
00048 // ===========================================================================
00049 // class definitions
00050 // ===========================================================================
00062 class MSMeanData_Net : public MSMeanData {
00063 public:
00071     class MSLaneMeanDataValues : public MSMeanData::MeanDataValues {
00072     public:
00076         MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd,
00077                              const std::set<std::string>* const vTypes=0,
00078                              const MSMeanData_Net* parent=0) throw();
00079 
00081         virtual ~MSLaneMeanDataValues() throw();
00082 
00085         void reset(bool afterWrite=false) throw();
00086 
00091         void addTo(MSMeanData::MeanDataValues& val) const throw();
00092 
00095 
00105         bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) throw();
00106 
00107 
00121         bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) throw();
00123 
00124         bool isEmpty() const throw();
00125 
00133         void write(OutputDevice& dev, const SUMOTime period,
00134                    const SUMOReal numLanes, const int numVehicles=-1) const throw(IOError);
00135 
00136     protected:
00147         void notifyMoveInternal(SUMOVehicle& veh, SUMOReal timeOnLane,
00148                                 SUMOReal speed) throw();
00149 
00150     public:
00154         unsigned nVehDeparted;
00155 
00157         unsigned nVehArrived;
00158 
00160         unsigned nVehEntered;
00161 
00163         unsigned nVehLeft;
00164 
00165     private:
00167         unsigned nVehLaneChangeFrom;
00168 
00170         unsigned nVehLaneChangeTo;
00171 
00173         SUMOReal waitSeconds;
00174 
00176         SUMOReal vehLengthSum;
00178 
00180         const MSMeanData_Net* myParent;
00181 
00182     };
00183 
00184 
00185 public:
00200     MSMeanData_Net(const std::string& id,
00201                    const SUMOTime dumpBegin, const SUMOTime dumpEnd,
00202                    const bool useLanes, const bool withEmpty, const bool withInternal,
00203                    const bool trackVehicles,
00204                    const SUMOReal maxTravelTime, const SUMOReal minSamples,
00205                    const SUMOReal haltSpeed, const std::set<std::string> vTypes) throw();
00206 
00207 
00209     virtual ~MSMeanData_Net() throw();
00210 
00211 protected:
00217     MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const throw(IOError);
00218 
00224     void resetOnly(SUMOTime stopTime) throw();
00225 
00226 private:
00228     const SUMOReal myHaltSpeed;
00229 
00231     MSMeanData_Net(const MSMeanData_Net&);
00232 
00234     MSMeanData_Net& operator=(const MSMeanData_Net&);
00235 
00236 };
00237 
00238 
00239 #endif
00240 
00241 /****************************************************************************/
00242 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines