NIVissimSingleTypeParser_Signalgeberdefinition.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 //
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 <cassert>
00031 #include <iostream>
00032 #include <utils/common/TplConvert.h>
00033 #include <utils/common/ToString.h>
00034 #include <utils/common/MsgHandler.h>
00035 #include <utils/common/VectorHelper.h>
00036 #include "../NIImporter_Vissim.h"
00037 #include "../tempstructs/NIVissimTL.h"
00038 #include "NIVissimSingleTypeParser_Signalgeberdefinition.h"
00039 
00040 #ifdef CHECK_MEMORY_LEAKS
00041 #include <foreign/nvwa/debug_new.h>
00042 #endif // CHECK_MEMORY_LEAKS
00043 
00044 
00045 // ===========================================================================
00046 // method definitions
00047 // ===========================================================================
00048 NIVissimSingleTypeParser_Signalgeberdefinition::NIVissimSingleTypeParser_Signalgeberdefinition(NIImporter_Vissim &parent)
00049         : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
00050 
00051 
00052 NIVissimSingleTypeParser_Signalgeberdefinition::~NIVissimSingleTypeParser_Signalgeberdefinition() {}
00053 
00054 
00055 bool
00056 NIVissimSingleTypeParser_Signalgeberdefinition::parse(std::istream &from) {
00057     //
00058     int id;
00059     from >> id;
00060     //
00061     std::string tag, name;
00062     tag = myRead(from);
00063     if (tag=="name") {
00064         name = readName(from);
00065         tag = myRead(from);
00066     }
00067     // skip optional "Beschriftung"
00068     tag = overrideOptionalLabel(from, tag);
00069     //
00070     int lsaid;
00071     IntVector groupids;
00072     if (tag=="lsa") {
00073         int groupid;
00074         from >> lsaid; // type-checking is missing!
00075         from >> tag; // "Gruppe"
00076         do {
00077             from >> groupid;
00078             groupids.push_back(groupid);
00079             tag = myRead(from);
00080         } while (tag=="oder");
00081         //
00082     } else {
00083         from >> tag; // strecke
00084         WRITE_WARNING("Omitting unknown traffic light.");
00085         return true;
00086     }
00087     if (tag=="typ") {
00088         from >> tag; // typ-value
00089         from >> tag; // "ort"
00090     }
00091 
00092     //
00093     from >> tag;
00094     int edgeid;
00095     from >> edgeid;
00096 
00097     from >> tag;
00098     int laneno;
00099     from >> laneno;
00100 
00101     from >> tag;
00102     int position;
00103     from >> position;
00104     //
00105     while (tag!="fahrzeugklassen") {
00106         tag = myRead(from);
00107     }
00108     IntVector assignedVehicleTypes = parseAssignedVehicleTypes(from, "N/A");
00109     //
00110     NIVissimTL::dictionary(lsaid); // !!! check whether someting is really done here
00111     NIVissimTL::NIVissimTLSignal *signal =
00112         new NIVissimTL::NIVissimTLSignal(lsaid, id, name, groupids, edgeid,
00113                                          laneno, (SUMOReal) position, assignedVehicleTypes);
00114     if (!NIVissimTL::NIVissimTLSignal::dictionary(lsaid, id, signal)) {
00115         throw 1; // !!!
00116     }
00117     return true;
00118 }
00119 
00120 
00121 
00122 /****************************************************************************/
00123 

Generated on Wed May 5 00:06:34 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6