|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // ------------------- 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 00020 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 00031 #include "NIVissimVehicleType.h" 00032 00033 #ifdef CHECK_MEMORY_LEAKS 00034 #include <foreign/nvwa/debug_new.h> 00035 #endif // CHECK_MEMORY_LEAKS 00036 00037 NIVissimVehicleType::DictType NIVissimVehicleType::myDict; 00038 00039 NIVissimVehicleType::NIVissimVehicleType(int id, 00040 const std::string& name, const std::string& category, SUMOReal length, 00041 const RGBColor& color, SUMOReal amax, SUMOReal dmax) 00042 : myID(id), myName(name), myCategory(category), myLength(length), 00043 myColor(color), myAMax(amax), myDMax(dmax) {} 00044 00045 00046 NIVissimVehicleType::~NIVissimVehicleType() {} 00047 00048 00049 00050 bool 00051 NIVissimVehicleType::dictionary(int id, 00052 const std::string& name, const std::string& category, SUMOReal length, 00053 const RGBColor& color, SUMOReal amax, SUMOReal dmax) { 00054 NIVissimVehicleType* o = new NIVissimVehicleType(id, name, category, 00055 length, color, amax, dmax); 00056 if (!dictionary(id, o)) { 00057 delete o; 00058 return false; 00059 } 00060 return true; 00061 } 00062 00063 00064 bool 00065 NIVissimVehicleType::dictionary(int id, NIVissimVehicleType* o) { 00066 DictType::iterator i=myDict.find(id); 00067 if (i==myDict.end()) { 00068 myDict[id] = o; 00069 return true; 00070 } 00071 return false; 00072 } 00073 00074 00075 NIVissimVehicleType* 00076 NIVissimVehicleType::dictionary(int id) { 00077 DictType::iterator i=myDict.find(id); 00078 if (i==myDict.end()) { 00079 return 0; 00080 } 00081 return (*i).second; 00082 } 00083 00084 void 00085 NIVissimVehicleType::clearDict() { 00086 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00087 delete(*i).second; 00088 } 00089 myDict.clear(); 00090 } 00091 00092 00093 00094 /****************************************************************************/ 00095