|
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-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 #include <string> 00031 #include <map> 00032 #include "PCTypeMap.h" 00033 00034 #ifdef CHECK_MEMORY_LEAKS 00035 #include <foreign/nvwa/debug_new.h> 00036 #endif // CHECK_MEMORY_LEAKS 00037 00038 00039 // =========================================================================== 00040 // method definitions 00041 // =========================================================================== 00042 PCTypeMap::PCTypeMap() throw() {} 00043 00044 00045 PCTypeMap::~PCTypeMap() throw() {} 00046 00047 00048 bool 00049 PCTypeMap::add(const std::string& id, const std::string& newid, 00050 const std::string& color, const std::string& prefix, 00051 int layer, bool discard, bool allowFill) throw() { 00052 if (has(id)) { 00053 return false; 00054 } 00055 TypeDef td; 00056 td.id = newid; 00057 td.color = color; 00058 td.layer = layer; 00059 td.discard = discard; 00060 td.allowFill = allowFill; 00061 td.prefix = prefix; 00062 myTypes[id] = td; 00063 return true; 00064 } 00065 00066 00067 const PCTypeMap::TypeDef& 00068 PCTypeMap::get(const std::string& id) throw() { 00069 return myTypes.find(id)->second; 00070 } 00071 00072 00073 bool 00074 PCTypeMap::has(const std::string& id) throw() { 00075 return myTypes.find(id)!=myTypes.end(); 00076 } 00077 00078 00079 00080 /****************************************************************************/ 00081