SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Inserts vehicles into the network when their departure time is reached 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 MSInsertionControl_h 00023 #define MSInsertionControl_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 "MSVehicleContainer.h" 00036 #include <vector> 00037 #include <map> 00038 #include <string> 00039 00040 00041 // =========================================================================== 00042 // class declarations 00043 // =========================================================================== 00044 class MSVehicle; 00045 class MSVehicleControl; 00046 00047 00048 // =========================================================================== 00049 // class definitions 00050 // =========================================================================== 00066 class MSInsertionControl { 00067 public: 00074 MSInsertionControl(MSVehicleControl& vc, SUMOTime maxDepartDelay, bool checkEdgesOnce) ; 00075 00076 00078 ~MSInsertionControl() ; 00079 00080 00097 unsigned int emitVehicles(SUMOTime time) ; 00098 00099 00106 void add(SUMOVehicle* veh) ; 00107 00108 00113 void add(SUMOVehicleParameter* pars) ; 00114 00115 00123 unsigned int getWaitingVehicleNo() const ; 00124 00125 00130 int getPendingFlowCount() const ; 00131 00132 00133 private: 00148 unsigned int tryInsert(SUMOTime time, SUMOVehicle* veh, 00149 MSVehicleContainer::VehicleVector& refusedEmits) ; 00150 00151 00156 void checkFlowWait(SUMOVehicle* veh) ; 00157 00158 00164 void checkPrevious(SUMOTime time) ; 00165 00166 00173 unsigned int checkFlows(SUMOTime time, 00174 MSVehicleContainer::VehicleVector& refusedEmits) ; 00175 00176 00177 private: 00179 MSVehicleControl& myVehicleControl; 00180 00182 MSVehicleContainer myAllVeh; 00183 00185 MSVehicleContainer::VehicleVector myRefusedEmits1, myRefusedEmits2; 00186 00190 struct Flow { 00192 SUMOVehicleParameter* pars; 00194 bool isVolatile; 00196 SUMOVehicle* vehicle; 00197 }; 00198 00200 std::vector<Flow> myFlows; 00201 00203 SUMOTime myMaxDepartDelay; 00204 00206 bool myCheckEdgesOnce; 00207 00208 00209 private: 00211 MSInsertionControl(const MSInsertionControl&); 00212 00214 MSInsertionControl& operator=(const MSInsertionControl&); 00215 00216 00217 }; 00218 00219 00220 #endif 00221 00222 /****************************************************************************/ 00223