NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition Class Reference

#include <NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h>

Inheritance diagram for NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition:

NIImporter_Vissim::VissimSingleTypeParser

Detailed Description

Definition at line 43 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h.


Public Member Functions

 NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition (NIImporter_Vissim &parent)
 Constructor.
bool parse (std::istream &from)
 Parses the data type from the given stream.
 ~NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition ()
 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 parseNumbered (std::istream &from)
 parses a full description of a disturbance
bool parseOnlyMe (std::istream &from)
 ?? (unknown vissim-description)
NIVissimExtendedEdgePoint parsePos (std::istream &from)
bool parsePositionDescribed (std::istream &from)
 parses a disturbance described by its position

Constructor & Destructor Documentation

NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition ( NIImporter_Vissim parent  ) 

NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::~NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition (  ) 

Destructor.

Definition at line 50 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

00050 {}


Member Function Documentation

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(), parse(), NIVissimSingleTypeParser_Querschnittsmessungsdefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::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(), parseNumbered(), parsePositionDescribed(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::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_Querverkehrsstoerungsdefinition::parse ( std::istream &  from  )  [virtual]

Parses the data type from the given stream.

Implements NIImporter_Vissim::VissimSingleTypeParser.

Definition at line 54 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), parseNumbered(), parseOnlyMe(), and parsePositionDescribed().

00054                                                                                 {
00055     std::string tag;
00056     tag = myRead(from);
00057     if (tag=="nureigenestrecke") {
00058         return parseOnlyMe(from);
00059     } else if (tag=="ort") {
00060         return parsePositionDescribed(from);
00061     } else if (tag=="nummer") {
00062         return parseNumbered(from);
00063     }
00064     MsgHandler::getErrorInstance()->inform(
00065         "NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition: format problem");
00066     throw 1;
00067 }

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_Querverkehrsstoerungsdefinition::parseNumbered ( std::istream &  from  )  [private]

parses a full description of a disturbance

Definition at line 111 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

References NIVissimDisturbance::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), parsePos(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), NIImporter_Vissim::VissimSingleTypeParser::readName(), and SUMOReal.

Referenced by parse().

00111                                                                                         {
00112     //
00113     int id;
00114     from >> id;
00115     //
00116     std::string tag;
00117     from >> tag;
00118     std::string name = readName(from);
00119     // skip optional "Beschriftung"
00120     while (tag!="ort") {
00121         tag = myRead(from);
00122     }
00123     //
00124     from >> tag; // "Strecke"
00125     NIVissimExtendedEdgePoint edge = parsePos(from);
00126     bool ok = true;
00127     do {
00128         from >> tag; // "Ort"
00129         from >> tag; // "Strecke"
00130         NIVissimExtendedEdgePoint by = parsePos(from);
00131         //
00132         SUMOReal timegap;
00133         from >> timegap;
00134 
00135         SUMOReal waygap;
00136         from >> tag;
00137         from >> waygap;
00138 
00139         SUMOReal vmax = -1;
00140         tag = readEndSecure(from);
00141         if (tag=="vmax") {
00142             from >> vmax;
00143         }
00144 
00145         ok = NIVissimDisturbance::dictionary(id, name, edge, by,
00146                                              timegap, waygap, vmax);
00147         if (tag!="DATAEND") {
00148             tag = readEndSecure(from);
00149         }
00150     } while (tag!="DATAEND"&&ok);
00151     return ok;
00152 }

bool NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseOnlyMe ( std::istream &  from  )  [private]

?? (unknown vissim-description)

Definition at line 70 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

Referenced by parse().

00070                                                                                       {
00071     std::string tag;
00072     from >> tag;
00073     return true;
00074 }

NIVissimExtendedEdgePoint NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePos ( std::istream &  from  )  [private]

Definition at line 157 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

References TplConvert< E >::_2int(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.

Referenced by parseNumbered(), and parsePositionDescribed().

00157                                                                                    {
00158     int edgeid;
00159     from >> edgeid; // type-checking is missing!
00160     //
00161     std::string tag;
00162     from >> tag;
00163     from >> tag;
00164     IntVector lanes;
00165     if (tag=="ALLE") {
00166         //lanes.push_back(1); // !!!
00167     } else {
00168         lanes.push_back(TplConvert<char>::_2int(tag.c_str()));
00169     }
00170     //
00171     SUMOReal position;
00172     from >> tag;
00173     from >> position;
00174     // assigned vehicle types
00175     IntVector types;
00176     from >> tag;
00177     while (tag!="zeitluecke"&&tag!="durch"&&tag!="DATAEND"&&tag!="alle") {
00178         tag = readEndSecure(from);
00179         if (tag!="DATAEND") {
00180             if (tag=="alle") {
00181                 types.push_back(-1);
00182                 from >> tag;
00183                 tag = "alle";
00184             } else if (tag!="zeitluecke"&&tag!="durch"&&tag!="DATAEND") {
00185                 int tmp = TplConvert<char>::_2int(tag.c_str());
00186                 types.push_back(tmp);
00187             }
00188         }
00189     }
00190     return NIVissimExtendedEdgePoint(edgeid, lanes, position, types);
00191 }

bool NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed ( std::istream &  from  )  [private]

parses a disturbance described by its position

Definition at line 78 of file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp.

References NIVissimDisturbance::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), parsePos(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.

Referenced by parse().

00078                                                                                                  {
00079     std::string tag = myRead(from);
00080     NIVissimExtendedEdgePoint edge = parsePos(from);
00081 //    from >> tag; // "Durch"
00082     bool ok = true;
00083     do {
00084         from >> tag; // "Strecke"
00085         NIVissimExtendedEdgePoint by = parsePos(from);
00086         //
00087         SUMOReal timegap;
00088         from >> timegap;
00089 
00090         from >> tag;
00091         SUMOReal waygap;
00092         from >> waygap;
00093 
00094         SUMOReal vmax = -1;
00095         tag = readEndSecure(from);
00096         if (tag=="vmax") {
00097             from >> vmax;
00098         }
00099         ok = NIVissimDisturbance::dictionary(-1, "", edge, by,
00100                                              timegap, waygap, vmax);
00101         if (tag!="DATAEND") {
00102             tag = readEndSecure(from);
00103         }
00104     } while (tag!="DATAEND"&&ok);
00105     return ok;
00106 }

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(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseFixedTime(), parseNumbered(), parsePos(), parsePositionDescribed(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::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]

void NIImporter_Vissim::VissimSingleTypeParser::readUntil ( std::istream &  from,
const std::string &  name 
) [protected, inherited]

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 }


The documentation for this class was generated from the following files:

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