SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A storage for type mappings 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 00021 00022 // =========================================================================== 00023 // included modules 00024 // =========================================================================== 00025 #ifdef _MSC_VER 00026 #include <windows_config.h> 00027 #else 00028 #include <config.h> 00029 #endif 00030 00031 #include <string> 00032 #include <map> 00033 #include "PCTypeMap.h" 00034 00035 #ifdef CHECK_MEMORY_LEAKS 00036 #include <foreign/nvwa/debug_new.h> 00037 #endif // CHECK_MEMORY_LEAKS 00038 00039 00040 // =========================================================================== 00041 // method definitions 00042 // =========================================================================== 00043 PCTypeMap::PCTypeMap() {} 00044 00045 00046 PCTypeMap::~PCTypeMap() {} 00047 00048 00049 bool 00050 PCTypeMap::add(const std::string& id, const std::string& newid, 00051 const std::string& color, const std::string& prefix, 00052 int layer, bool discard, bool allowFill) { 00053 if (has(id)) { 00054 return false; 00055 } 00056 TypeDef td; 00057 td.id = newid; 00058 td.color = color; 00059 td.layer = layer; 00060 td.discard = discard; 00061 td.allowFill = allowFill; 00062 td.prefix = prefix; 00063 myTypes[id] = td; 00064 return true; 00065 } 00066 00067 00068 const PCTypeMap::TypeDef& 00069 PCTypeMap::get(const std::string& id) { 00070 return myTypes.find(id)->second; 00071 } 00072 00073 00074 bool 00075 PCTypeMap::has(const std::string& id) { 00076 return myTypes.find(id) != myTypes.end(); 00077 } 00078 00079 00080 00081 /****************************************************************************/ 00082