SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 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 <iostream> 00033 #include <utils/common/TplConvert.h> 00034 #include "../NIImporter_Vissim.h" 00035 #include "../tempstructs/NIVissimSource.h" 00036 #include "NIVissimSingleTypeParser_Zuflussdefinition.h" 00037 00038 #ifdef CHECK_MEMORY_LEAKS 00039 #include <foreign/nvwa/debug_new.h> 00040 #endif // CHECK_MEMORY_LEAKS 00041 00042 00043 // =========================================================================== 00044 // method definitions 00045 // =========================================================================== 00046 NIVissimSingleTypeParser_Zuflussdefinition::NIVissimSingleTypeParser_Zuflussdefinition(NIImporter_Vissim& parent) 00047 : NIImporter_Vissim::VissimSingleTypeParser(parent) {} 00048 00049 00050 NIVissimSingleTypeParser_Zuflussdefinition::~NIVissimSingleTypeParser_Zuflussdefinition() {} 00051 00052 00053 bool 00054 NIVissimSingleTypeParser_Zuflussdefinition::parse(std::istream& from) { 00055 std::string id, edgeid; 00056 from >> id; // type-checking is missing! 00057 std::string tag, name; 00058 // override some optional values till q 00059 while (tag != "q") { 00060 tag = overrideOptionalLabel(from); 00061 if (tag == "name") { 00062 name = readName(from); 00063 } else if (tag == "strecke") { 00064 from >> edgeid; // type-checking is missing! 00065 } 00066 } 00067 // read q 00068 bool exact = false; 00069 SUMOReal q; 00070 tag = myRead(from); 00071 if (tag == "exakt") { 00072 exact = true; 00073 tag = myRead(from); 00074 } 00075 q = TplConvert<char>::_2SUMOReal(tag.c_str()); 00076 // read the vehicle types 00077 from >> tag; 00078 int vehicle_combination; 00079 from >> vehicle_combination; 00080 // check whether optional time information is available 00081 tag = readEndSecure(from); 00082 SUMOReal beg, end; 00083 beg = -1; 00084 end = -1; 00085 if (tag == "zeit") { 00086 from >> tag; 00087 from >> beg; 00088 from >> tag; 00089 from >> end; 00090 } 00091 return NIVissimSource::dictionary(id, name, edgeid, q, exact, vehicle_combination, 00092 beg, end); 00093 } 00094 00095 00096 00097 /****************************************************************************/ 00098