SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // A container for vehicles sorted by their departure time 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef ROVehicleCont_h 00022 #define ROVehicleCont_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <string> 00035 #include <map> 00036 #include <queue> 00037 #include <vector> 00038 #include "ROVehicle.h" 00039 #include <utils/common/NamedObjectCont.h> 00040 #include "ROHelper.h" 00041 00042 00043 // =========================================================================== 00044 // class definitions 00045 // =========================================================================== 00054 class ROVehicleCont : public NamedObjectCont<ROVehicle*> { 00055 public: 00057 ROVehicleCont() ; 00058 00059 00061 ~ROVehicleCont() ; 00062 00063 00071 const ROVehicle* getTopVehicle() const ; 00072 00073 00087 virtual bool add(const std::string& id, ROVehicle* item) ; 00088 00089 00097 void clear() ; 00098 00099 00111 bool erase(const std::string& id) ; 00112 00113 00114 private: 00122 void rebuildSorted() ; 00123 00124 00125 private: 00127 mutable std::priority_queue<ROVehicle*, std::vector<ROVehicle*>, ROVehicleByDepartureComperator> mySorted; 00128 00129 00130 private: 00132 ROVehicleCont(const ROVehicleCont& src); 00133 00135 ROVehicleCont& operator=(const ROVehicleCont& src); 00136 00137 }; 00138 00139 00140 #endif 00141 00142 /****************************************************************************/ 00143