00001 /****************************************************************************/ 00007 // Inserts vehicles into the network when their departure time is reached 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 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 MSEmitControl_h 00020 #define MSEmitControl_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 "MSVehicleContainer.h" 00033 #include <vector> 00034 #include <map> 00035 #include <string> 00036 00037 00038 // =========================================================================== 00039 // class declarations 00040 // =========================================================================== 00041 class MSVehicle; 00042 class MSVehicleControl; 00043 00044 00045 // =========================================================================== 00046 // class definitions 00047 // =========================================================================== 00063 class MSEmitControl { 00064 public: 00071 MSEmitControl(MSVehicleControl &vc, SUMOTime maxDepartDelay, bool checkEdgesOnce) throw(); 00072 00073 00075 ~MSEmitControl() throw(); 00076 00077 00094 unsigned int emitVehicles(SUMOTime time) throw(ProcessError); 00095 00096 00103 void add(MSVehicle *veh) throw(); 00104 00105 00110 void add(SUMOVehicleParameter *pars) throw(); 00111 00112 00121 unsigned int getWaitingVehicleNo() const throw(); 00122 00123 00128 bool hasPendingFlows() const throw(); 00129 00130 00131 private: 00150 unsigned int tryEmit(SUMOTime time, MSVehicle *veh, 00151 MSVehicleContainer::VehicleVector &refusedEmits) throw(ProcessError); 00152 00153 00158 void checkFlowWait(MSVehicle *veh) throw(); 00159 00160 00166 void checkPrevious(SUMOTime time) throw(); 00167 00168 00175 unsigned int checkFlows(SUMOTime time, 00176 MSVehicleContainer::VehicleVector &refusedEmits) throw(ProcessError); 00177 00178 00179 private: 00181 MSVehicleControl &myVehicleControl; 00182 00184 MSVehicleContainer myAllVeh; 00185 00187 MSVehicleContainer::VehicleVector myRefusedEmits1, myRefusedEmits2; 00188 00192 struct Flow { 00194 SUMOVehicleParameter* pars; 00196 bool isVolatile; 00198 MSVehicle *vehicle; 00199 }; 00200 00202 std::vector<Flow> myFlows; 00203 00205 SUMOTime myMaxDepartDelay; 00206 00208 bool myCheckEdgesOnce; 00209 00210 00211 private: 00213 MSEmitControl(const MSEmitControl&); 00214 00216 MSEmitControl& operator=(const MSEmitControl&); 00217 00218 00219 }; 00220 00221 00222 #endif 00223 00224 /****************************************************************************/ 00225
1.5.6