00001 /****************************************************************************/ 00007 // A container for vehicles sorted by their departure time 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 ROVehicleCont_h 00020 #define ROVehicleCont_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 <string> 00033 #include <map> 00034 #include <queue> 00035 #include <vector> 00036 #include "ROVehicle.h" 00037 #include <utils/common/NamedObjectCont.h> 00038 #include "ROHelper.h" 00039 00040 00041 // =========================================================================== 00042 // class definitions 00043 // =========================================================================== 00052 class ROVehicleCont : public NamedObjectCont<ROVehicle*> { 00053 public: 00055 ROVehicleCont() throw(); 00056 00057 00059 ~ROVehicleCont() throw(); 00060 00061 00069 const ROVehicle * const getTopVehicle() const throw(); 00070 00071 00085 virtual bool add(const std::string &id, ROVehicle *item) throw(); 00086 00087 00095 void clear() throw(); 00096 00097 00109 bool erase(const std::string &id) throw(); 00110 00111 00112 private: 00120 void rebuildSorted() throw(); 00121 00122 00123 private: 00125 mutable std::priority_queue<ROVehicle*, std::vector<ROVehicle*>, ROVehicleByDepartureComperator> mySorted; 00126 00127 00128 private: 00130 ROVehicleCont(const ROVehicleCont &src); 00131 00133 ROVehicleCont &operator=(const ROVehicleCont &src); 00134 00135 }; 00136 00137 00138 #endif 00139 00140 /****************************************************************************/ 00141
1.5.6