00001 /****************************************************************************/ 00007 // Class for the io-ing between junctions (nodes) and the computers 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 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 <fstream> 00032 #include <iostream> 00033 #include <algorithm> 00034 #include <vector> 00035 #include <map> 00036 #include "NBJunctionLogicCont.h" 00037 #include <utils/common/FileHelpers.h> 00038 #include <utils/common/UtilExceptions.h> 00039 #include <utils/iodevices/OutputDevice.h> 00040 00041 #ifdef CHECK_MEMORY_LEAKS 00042 #include <foreign/nvwa/debug_new.h> 00043 #endif // CHECK_MEMORY_LEAKS 00044 00045 00046 // =========================================================================== 00047 // method definitions 00048 // =========================================================================== 00049 NBJunctionLogicCont::NBJunctionLogicCont() {} 00050 00051 00052 NBJunctionLogicCont::~NBJunctionLogicCont() { 00053 clear(); 00054 } 00055 00056 00057 bool 00058 NBJunctionLogicCont::exists(const std::string &key) { 00059 return myMap.find(key)!=myMap.end(); 00060 } 00061 00062 00063 void 00064 NBJunctionLogicCont::add(const std::string &key, 00065 const std::string &xmlDescription) { 00066 LogicMap::iterator i=myMap.find(key); 00067 if (i!=myMap.end()) { 00068 std::string tmp = (*i).second; 00069 } 00070 myMap.insert(LogicMap::value_type(key, xmlDescription)); 00071 } 00072 00073 00074 void 00075 NBJunctionLogicCont::writeXML(OutputDevice &into) { 00076 for (LogicMap::iterator i=myMap.begin(); i!=myMap.end(); i++) { 00077 into << (*i).second << "\n"; 00078 } 00079 into << "\n"; 00080 } 00081 00082 00083 void 00084 NBJunctionLogicCont::clear() { 00085 myMap.clear(); 00086 } 00087 00088 00089 00090 /****************************************************************************/ 00091
1.5.6