#include <NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h>

Definition at line 44 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h.
Public Member Functions | |
| NIVissimSingleTypeParser_Lichtsignalanlagendefinition (NIImporter_Vissim &parent) | |
| Constructor. | |
| bool | parse (std::istream &from) |
| Parses the data type from the given stream. | |
| ~NIVissimSingleTypeParser_Lichtsignalanlagendefinition () | |
| Destructor. | |
Protected Member Functions | |
| Position2D | getPosition2D (std::istream &from) |
| returns the 2d-position saved as next within the stream | |
| std::string | myRead (std::istream &from) |
| reads from the stream and returns the lower case version of the read value | |
| std::string | overrideOptionalLabel (std::istream &from, const std::string &tag="") |
| overrides the optional label definition; returns the next tag as done by readEndSecure | |
| IntVector | parseAssignedVehicleTypes (std::istream &from, const std::string &next) |
| parses a listof vehicle types assigned to the current data field One should remeber, that -1 means "all" vehicle types | |
| std::string | readEndSecure (std::istream &from, const std::vector< std::string > &excl) |
| std::string | readEndSecure (std::istream &from, const std::string &excl="") |
| as myRead, but returns "DATAEND" when the current field has ended | |
| NIVissimExtendedEdgePoint | readExtEdgePointDef (std::istream &from) |
| std::string | readName (std::istream &from) |
| Reads the structures name We cannot use the "<<" operator, as names may contain more than one word which are joined using '"'. | |
| void | readUntil (std::istream &from, const std::string &name) |
| Reads from the stream until the keywor occurs. | |
| bool | skipOverreading (std::istream &from, const std::string &name="") |
| Overreads the named parameter (if) given and skips the rest until "DATAEND". | |
Private Member Functions | |
| bool | parseFixedTime (int id, std::string name, std::istream &from) |
| parses a traffic light with fixed times (no other types are supported by now) | |
| bool | parseRestActuated (int id, std::string name, std::istream &from, const std::string &type) |
| Parses actuated traffic lights (beside VAS). | |
| bool | parseVAS (int id, std::string name, std::istream &from) |
| Parses a vas-traffic light; All other actuated traffic lights are parsed using "parseRestActuated" as they have a different format. | |
| NIVissimSingleTypeParser_Lichtsignalanlagendefinition::NIVissimSingleTypeParser_Lichtsignalanlagendefinition | ( | NIImporter_Vissim & | parent | ) |
Constructor.
Definition at line 45 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
00046 : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
| NIVissimSingleTypeParser_Lichtsignalanlagendefinition::~NIVissimSingleTypeParser_Lichtsignalanlagendefinition | ( | ) |
Destructor.
Definition at line 49 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
| Position2D NIImporter_Vissim::VissimSingleTypeParser::getPosition2D | ( | std::istream & | from | ) | [protected, inherited] |
returns the 2d-position saved as next within the stream
Definition at line 222 of file NIImporter_Vissim.cpp.
References SUMOReal.
Referenced by NIVissimSingleTypeParser_Streckendefinition::parse(), and NIVissimSingleTypeParser_Knotendefinition::parse().
00222 { 00223 SUMOReal x, y; 00224 from >> x; // type-checking is missing! 00225 from >> y; // type-checking is missing! 00226 return Position2D(x, y); 00227 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::myRead | ( | std::istream & | from | ) | [protected, inherited] |
reads from the stream and returns the lower case version of the read value
Definition at line 144 of file NIImporter_Vissim.cpp.
References StringUtils::to_lower_case().
Referenced by NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel(), NIVissimSingleTypeParser_Zusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verlustzeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), NIVissimSingleTypeParser_Routenentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Reisezeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parse(), NIVissimSingleTypeParser_Querschnittsmessungsdefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), parse(), NIVissimSingleTypeParser_Langsamfahrbereichdefinition::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Haltestellendefinition::parse(), NIVissimSingleTypeParser_Fensterdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), NIVissimSingleTypeParser_Detektordefinition::parse(), NIVissimSingleTypeParser_Auswertungsdefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parseFixedTime(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed(), parseRestActuated(), NIVissimSingleTypeParser_Signalgruppendefinition::parseVAS(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), NIImporter_Vissim::VissimSingleTypeParser::readUntil(), and NIImporter_Vissim::VissimSingleTypeParser::skipOverreading().
00144 { 00145 std::string tmp; 00146 from >> tmp; 00147 return StringUtils::to_lower_case(tmp); 00148 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel | ( | std::istream & | from, | |
| const std::string & | tag = "" | |||
| ) | [protected, inherited] |
overrides the optional label definition; returns the next tag as done by readEndSecure
Definition at line 201 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead().
Referenced by NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), and NIVissimSingleTypeParser_Knotendefinition::parse().
00202 { 00203 std::string tmp; 00204 if (tag=="") { 00205 tmp = myRead(from); 00206 } else { 00207 tmp = tag; 00208 } 00209 if (tmp=="beschriftung") { 00210 tmp = myRead(from); 00211 if (tmp=="keine") { 00212 from >> tmp; 00213 } 00214 tmp = myRead(from); 00215 tmp = myRead(from); 00216 } 00217 return tmp; 00218 }
| bool NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parse | ( | std::istream & | from | ) | [virtual] |
Parses the data type from the given stream.
Implements NIImporter_Vissim::VissimSingleTypeParser.
Definition at line 53 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
References MsgHandler::getErrorInstance(), MsgHandler::inform(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), parseFixedTime(), parseRestActuated(), parseVAS(), and NIImporter_Vissim::VissimSingleTypeParser::readName().
00053 { 00054 // 00055 int id; 00056 from >> id; 00057 // 00058 std::string tag, name; 00059 tag = myRead(from); 00060 if (tag=="name") { 00061 name = readName(from); 00062 tag = myRead(from); 00063 } 00064 // type 00065 std::string type; 00066 type = myRead(from); 00067 if (type=="festzeit") { 00068 return parseFixedTime(id, name, from); 00069 } 00070 if (type=="vas") { 00071 return parseVAS(id, name, from); 00072 } 00073 if (type=="vsplus") { 00074 return parseRestActuated(id, name, from, type); 00075 } 00076 if (type=="trends") { 00077 return parseRestActuated(id, name, from, type); 00078 } 00079 if (type=="vap") { 00080 return parseRestActuated(id, name, from, type); 00081 } 00082 if (type=="tl") { 00083 return parseRestActuated(id, name, from, type); 00084 } 00085 if (type=="pos") { 00086 return parseRestActuated(id, name, from, type); 00087 } 00088 if (type=="nema") { 00089 return parseRestActuated(id, name, from, type); 00090 } 00091 if (type=="extern") { 00092 return parseRestActuated(id, name, from, type); 00093 } 00094 MsgHandler::getErrorInstance()->inform("Unsupported LSA-Type '" + type + "' occured."); 00095 return false; 00096 }
| IntVector NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes | ( | std::istream & | from, | |
| const std::string & | next | |||
| ) | [protected, inherited] |
parses a listof vehicle types assigned to the current data field One should remeber, that -1 means "all" vehicle types
Definition at line 231 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::readEndSecure().
Referenced by NIVissimSingleTypeParser_Signalgeberdefinition::parse().
00232 { 00233 std::string tmp = readEndSecure(from); 00234 IntVector ret; 00235 if (tmp=="alle") { 00236 ret.push_back(-1); 00237 return ret; 00238 } 00239 while (tmp!="DATAEND"&&tmp!=next) { 00240 ret.push_back(TplConvert<char>::_2int(tmp.c_str())); 00241 tmp = readEndSecure(from); 00242 } 00243 return ret; 00244 }
| bool NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseFixedTime | ( | int | id, | |
| std::string | name, | |||
| std::istream & | from | |||
| ) | [private] |
parses a traffic light with fixed times (no other types are supported by now)
Definition at line 100 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
References NIVissimTL::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.
Referenced by parse().
00101 { 00102 std::string type = "festzeit"; 00103 std::string tag; 00104 from >> tag; 00105 // 00106 SUMOReal absdur; 00107 from >> absdur; // type-checking is missing! 00108 // 00109 tag = readEndSecure(from); 00110 SUMOReal offset = 0; 00111 if (tag=="versatz") { 00112 from >> offset; // type-checking is missing! 00113 } 00114 if (tag!="szpkonfdatei"&&tag!="DATAEND"&&tag!="progdatei") { 00115 tag = readEndSecure(from); 00116 if (tag=="szpkonfdatei"||tag=="progdatei") { 00117 type = "festzeit_fake"; 00118 } 00119 } 00120 return NIVissimTL::dictionary(id, type, name, (SUMOTime) absdur, (SUMOTime) offset); 00121 }
| bool NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated | ( | int | id, | |
| std::string | name, | |||
| std::istream & | from, | |||
| const std::string & | type | |||
| ) | [private] |
Parses actuated traffic lights (beside VAS).
Definition at line 143 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
References NIVissimTL::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.
Referenced by parse().
00144 { 00145 std::string tag; 00146 from >> tag; 00147 // 00148 SUMOReal absdur; 00149 from >> absdur; // type-checking is missing! 00150 // 00151 tag = readEndSecure(from); 00152 SUMOReal offset = 0; 00153 if (tag=="versatz") { 00154 from >> offset; // type-checking is missing! 00155 } 00156 while (tag!="datei") { 00157 tag = myRead(from); 00158 } 00159 return NIVissimTL::dictionary(id, type, name, (SUMOTime) absdur, (SUMOTime) offset); 00160 }
| bool NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseVAS | ( | int | id, | |
| std::string | name, | |||
| std::istream & | from | |||
| ) | [private] |
Parses a vas-traffic light; All other actuated traffic lights are parsed using "parseRestActuated" as they have a different format.
Definition at line 125 of file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp.
References NIVissimTL::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.
Referenced by parse().
00126 { 00127 std::string tag; 00128 from >> tag; 00129 // 00130 SUMOReal absdur; 00131 from >> absdur; // type-checking is missing! 00132 // 00133 tag = readEndSecure(from); 00134 SUMOReal offset = 0; 00135 if (tag=="versatz") { 00136 from >> offset; // type-checking is missing! 00137 } 00138 return NIVissimTL::dictionary(id, "vas", name, (SUMOTime) absdur, (SUMOTime) offset); 00139 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readEndSecure | ( | std::istream & | from, | |
| const std::vector< std::string > & | excl | |||
| ) | [protected, inherited] |
Definition at line 171 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::admitContinue(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIImporter_Vissim::VissimSingleTypeParser::myVissimParent, and StringUtils::to_lower_case().
00172 { 00173 std::vector<std::string> myExcl; 00174 std::vector<std::string>::const_iterator i; 00175 for (i=excl.begin(); i!=excl.end(); i++) { 00176 std::string mes = StringUtils::to_lower_case(*i); 00177 myExcl.push_back(mes); 00178 } 00179 std::string tmp = myRead(from); 00180 if (tmp=="") { 00181 return "DATAEND"; 00182 } 00183 00184 bool equals = false; 00185 for (i=myExcl.begin(); i!=myExcl.end()&&!equals; i++) { 00186 if ((*i)==tmp) { 00187 equals = true; 00188 } 00189 } 00190 if (!equals 00191 && 00192 (tmp.substr(0, 2)=="--"||!myVissimParent.admitContinue(tmp)) 00193 ) { 00194 return "DATAEND"; 00195 } 00196 return StringUtils::to_lower_case(tmp); 00197 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readEndSecure | ( | std::istream & | from, | |
| const std::string & | excl = "" | |||
| ) | [protected, inherited] |
as myRead, but returns "DATAEND" when the current field has ended
Definition at line 153 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::admitContinue(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIImporter_Vissim::VissimSingleTypeParser::myVissimParent, and StringUtils::to_lower_case().
Referenced by NIVissimSingleTypeParser_Zusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_Zeitenverteilungsdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verlustzeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Stopschilddefinition::parse(), NIVissimSingleTypeParser_Routenentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Reisezeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Querschnittsmessungsdefinition::parse(), NIVissimSingleTypeParser_Laengenverteilungsdefinition::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Kantensperrung::parse(), NIVissimSingleTypeParser_Haltestellendefinition::parse(), NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), NIVissimSingleTypeParser_DynUml::parse(), NIVissimSingleTypeParser_Detektordefinition::parse(), NIVissimSingleTypeParser_Auswertungsdefinition::parse(), NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes(), parseFixedTime(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePos(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed(), parseRestActuated(), parseVAS(), NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef(), and NIImporter_Vissim::VissimSingleTypeParser::skipOverreading().
00154 { 00155 std::string myExcl = StringUtils::to_lower_case(excl); 00156 std::string tmp = myRead(from); 00157 if (tmp=="") { 00158 return "DATAEND"; 00159 } 00160 if (tmp!=myExcl 00161 && 00162 (tmp.substr(0, 2)=="--"||!myVissimParent.admitContinue(tmp)) 00163 ) { 00164 return "DATAEND"; 00165 } 00166 return StringUtils::to_lower_case(tmp); 00167 }
| NIVissimExtendedEdgePoint NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef | ( | std::istream & | from | ) | [protected, inherited] |
Definition at line 248 of file NIImporter_Vissim.cpp.
References TplConvert< E >::_2int(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.
Referenced by NIVissimSingleTypeParser_Verbindungsdefinition::parse().
00249 { 00250 std::string tag; 00251 from >> tag; // "Strecke" 00252 int edgeid; 00253 from >> edgeid; // type-checking is missing! 00254 from >> tag; // "Spuren" 00255 IntVector lanes; 00256 while (tag!="bei") { 00257 tag = readEndSecure(from); 00258 if (tag!="bei") { 00259 int lane = TplConvert<char>::_2int(tag.c_str()); 00260 lanes.push_back(lane-1); 00261 } 00262 } 00263 SUMOReal position; 00264 from >> position; 00265 IntVector dummy; 00266 return NIVissimExtendedEdgePoint(edgeid, lanes, position, dummy); 00267 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readName | ( | std::istream & | from | ) | [protected, inherited] |
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word which are joined using '"'.
Definition at line 271 of file NIImporter_Vissim.cpp.
References StringUtils::convertUmlaute().
Referenced by NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Kennungszeile::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), and NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered().
00271 { 00272 std::string name; 00273 from >> name; 00274 if (name[0]=='"') { 00275 while (name[name.length()-1]!='"') { 00276 std::string tmp; 00277 from >> tmp; 00278 name = name + " " + tmp; 00279 } 00280 name = name.substr(1, name.length()-2); 00281 } 00282 return StringUtils::convertUmlaute(name); 00283 }
| void NIImporter_Vissim::VissimSingleTypeParser::readUntil | ( | std::istream & | from, | |
| const std::string & | name | |||
| ) | [protected, inherited] |
Reads from the stream until the keywor occurs.
Definition at line 287 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead().
Referenced by NIVissimSingleTypeParser_Streckentypdefinition::parse(), NIVissimSingleTypeParser_Stopschilddefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), NIVissimSingleTypeParser_Langsamfahrbereichdefinition::parse(), NIVissimSingleTypeParser_Fensterdefinition::parse(), NIVissimSingleTypeParser_Fahrverhaltendefinition::parse(), and NIVissimSingleTypeParser_DynUml::parse().
00288 { 00289 std::string tag; 00290 while (tag!=name) { 00291 tag = myRead(from); 00292 } 00293 }
| bool NIImporter_Vissim::VissimSingleTypeParser::skipOverreading | ( | std::istream & | from, | |
| const std::string & | name = "" | |||
| ) | [protected, inherited] |
Overreads the named parameter (if) given and skips the rest until "DATAEND".
Definition at line 296 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead(), and NIImporter_Vissim::VissimSingleTypeParser::readEndSecure().
Referenced by NIVissimSingleTypeParser_Stauzaehlerdefinition::parse(), NIVissimSingleTypeParser_Richtungsentscheidungsdefinition::parse(), and NIVissimSingleTypeParser_Messungsdefinition::parse().
00297 { 00298 std::string tag; 00299 while (tag!=name) { 00300 tag = myRead(from); 00301 } 00302 while (tag!="DATAEND") { 00303 tag = readEndSecure(from); 00304 } 00305 return true; 00306 }
1.5.6