SUMO - Simulation of Urban MObility

MSInsertionControl.h

Go to the documentation of this file.
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 (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 MSInsertionControl_h
00020 #define MSInsertionControl_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 MSInsertionControl {
00064 public:
00071     MSInsertionControl(MSVehicleControl& vc, SUMOTime maxDepartDelay, bool checkEdgesOnce) throw();
00072 
00073 
00075     ~MSInsertionControl() throw();
00076 
00077 
00094     unsigned int emitVehicles(SUMOTime time) throw(ProcessError);
00095 
00096 
00103     void add(SUMOVehicle* veh) throw();
00104 
00105 
00110     void add(SUMOVehicleParameter* pars) throw();
00111 
00112 
00120     unsigned int getWaitingVehicleNo() const throw();
00121 
00122 
00127     int getPendingFlowCount() const throw();
00128 
00129 
00130 private:
00145     unsigned int tryInsert(SUMOTime time, SUMOVehicle* veh,
00146                            MSVehicleContainer::VehicleVector& refusedEmits) throw(ProcessError);
00147 
00148 
00153     void checkFlowWait(SUMOVehicle* veh) throw();
00154 
00155 
00161     void checkPrevious(SUMOTime time) throw();
00162 
00163 
00170     unsigned int checkFlows(SUMOTime time,
00171                             MSVehicleContainer::VehicleVector& refusedEmits) throw(ProcessError);
00172 
00173 
00174 private:
00176     MSVehicleControl& myVehicleControl;
00177 
00179     MSVehicleContainer myAllVeh;
00180 
00182     MSVehicleContainer::VehicleVector myRefusedEmits1, myRefusedEmits2;
00183 
00187     struct Flow {
00189         SUMOVehicleParameter* pars;
00191         bool isVolatile;
00193         SUMOVehicle* vehicle;
00194     };
00195 
00197     std::vector<Flow> myFlows;
00198 
00200     SUMOTime myMaxDepartDelay;
00201 
00203     bool myCheckEdgesOnce;
00204 
00205 
00206 private:
00208     MSInsertionControl(const MSInsertionControl&);
00209 
00211     MSInsertionControl& operator=(const MSInsertionControl&);
00212 
00213 
00214 };
00215 
00216 
00217 #endif
00218 
00219 /****************************************************************************/
00220 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines