NIVissimSingleTypeParser_Signalgruppendefinition Class Reference

#include <NIVissimSingleTypeParser_Signalgruppendefinition.h>

Inheritance diagram for NIVissimSingleTypeParser_Signalgruppendefinition:

NIImporter_Vissim::VissimSingleTypeParser

Detailed Description

Definition at line 43 of file NIVissimSingleTypeParser_Signalgruppendefinition.h.


Public Member Functions

 NIVissimSingleTypeParser_Signalgruppendefinition (NIImporter_Vissim &parent)
 Constructor.
bool parse (std::istream &from)
 Parses the data type from the given stream.
 ~NIVissimSingleTypeParser_Signalgruppendefinition ()
 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 parseExternFixedTime (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs fixed time traffic light with an extern definition.
bool parseFixedTime (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a fixed time traffic light.
bool parsePOS (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a POS traffic light.
bool parseTL (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a TL traffic light.
bool parseTRENDS (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a TRENDS traffic light.
bool parseVAP (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a VAStraffic light.
bool parseVAS (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a VAS traffic light.
bool parseVSPLUS (int id, const std::string &name, int lsaid, std::istream &from)
 Parses a traffic light group which belongs to a VSPLUS traffic light.

Constructor & Destructor Documentation

NIVissimSingleTypeParser_Signalgruppendefinition::NIVissimSingleTypeParser_Signalgruppendefinition ( NIImporter_Vissim parent  ) 

Constructor.

Definition at line 48 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

NIVissimSingleTypeParser_Signalgruppendefinition::~NIVissimSingleTypeParser_Signalgruppendefinition (  ) 

Destructor.

Definition at line 52 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

00052 {}


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(), parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), NIVissimSingleTypeParser_Routenentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Reisezeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::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(), parseFixedTime(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated(), 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_Signalgruppendefinition::parse ( std::istream &  from  )  [virtual]

Parses the data type from the given stream.

Implements NIImporter_Vissim::VissimSingleTypeParser.

Definition at line 56 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References NIVissimTL::dictionary(), MsgHandler::getErrorInstance(), NIVissimTL::getType(), MsgHandler::getWarningInstance(), MsgHandler::inform(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), parseFixedTime(), parsePOS(), parseTL(), parseTRENDS(), parseVAP(), parseVAS(), parseVSPLUS(), and NIImporter_Vissim::VissimSingleTypeParser::readName().

00056                                                                         {
00057     //
00058     int id;
00059     from >> id; // type-checking is missing!
00060     //
00061     std::string tag;
00062     tag = myRead(from);
00063     std::string name;
00064     if (tag=="name") {
00065         name = readName(from);
00066         tag = myRead(from);
00067     }
00068     //
00069     int lsaid;
00070     from >> lsaid;
00071     NIVissimTL *tl = NIVissimTL::dictionary(lsaid);
00072     if (tl==0) {
00073         MsgHandler::getErrorInstance()->inform("A traffic light group with an unknown traffic light occured.\n  Group-ID: " + toString<int>(id)
00074                                                + "\n  TrafficLight-ID: " + toString<int>(lsaid));
00075         return false;
00076     }
00077     std::string type = tl->getType();
00078     if (type=="festzeit") {
00079         return parseFixedTime(id, name, lsaid, from);
00080     }
00081     if (type=="festzeit_fake") {
00082         return parseFixedTime(id, name, lsaid, from);
00083 //        return parseExternFixedTime(id, name, lsaid, from);
00084     }
00085     if (type=="vas") {
00086         return parseVAS(id, name, lsaid, from);
00087     }
00088     if (type=="vsplus") {
00089         return parseVSPLUS(id, name, lsaid, from);
00090     }
00091     if (type=="trends") {
00092         return parseTRENDS(id, name, lsaid, from);
00093     }
00094     if (type=="vap") {
00095         return parseVAP(id, name, lsaid, from);
00096     }
00097     if (type=="tl") {
00098         return parseTL(id, name, lsaid, from);
00099     }
00100     if (type=="pos") {
00101         return parsePOS(id, name, lsaid, from);
00102     }
00103     MsgHandler::getWarningInstance()->inform("Unsupported LSA-Type '" + type + "' occured.");
00104     return true;
00105 }

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_Signalgruppendefinition::parseExternFixedTime ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs fixed time traffic light with an extern definition.

Definition at line 202 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

00203                                                             {
00204     WRITE_WARNING("externally defined traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00205     return true;
00206 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseFixedTime ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a fixed time traffic light.

Definition at line 109 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References NIVissimTL::NIVissimTLSignalGroup::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), and SUMOReal.

Referenced by parse().

00110                                                                 {
00111     //
00112     bool isGreenBegin;
00113     DoubleVector times;
00114     std::string tag = myRead(from);
00115     if (tag=="dauergruen") {
00116         isGreenBegin = true;
00117         from >> tag;
00118     } else if (tag=="dauerrot") {
00119         isGreenBegin = false;
00120         from >> tag;
00121     } else {
00122         // the first phase will be green
00123         isGreenBegin = true;
00124         while (tag=="rotende"||tag=="gruenanfang") {
00125             SUMOReal point;
00126             from >> point; // type-checking is missing!
00127             times.push_back(point);
00128             from >> tag;
00129             from >> point; // type-checking is missing!
00130             times.push_back(point);
00131             tag = myRead(from);
00132         }
00133     }
00134     //
00135     SUMOReal tredyellow, tyellow;
00136     from >> tredyellow;
00137     from >> tag;
00138     from >> tyellow;
00139     NIVissimTL::NIVissimTLSignalGroup *group =
00140         new NIVissimTL::NIVissimTLSignalGroup(
00141         lsaid, id, name, isGreenBegin, times, (SUMOTime) tredyellow, (SUMOTime) tyellow);
00142     if (!NIVissimTL::NIVissimTLSignalGroup::dictionary(lsaid, id, group)) {
00143         throw 1; // !!!
00144     }
00145     return true;
00146 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parsePOS ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a POS traffic light.

Definition at line 194 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

Referenced by parse().

00195                                                             {
00196     WRITE_WARNING("POS traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00197     return true;
00198 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseTL ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a TL traffic light.

Definition at line 186 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

Referenced by parse().

00187                                                             {
00188     WRITE_WARNING("TL traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00189     return true;
00190 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseTRENDS ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a TRENDS traffic light.

Definition at line 170 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

Referenced by parse().

00171                                                             {
00172     WRITE_WARNING("TRENDS traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00173     return true;
00174 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseVAP ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a VAStraffic light.

Definition at line 178 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

Referenced by parse().

00179                                                             {
00180     WRITE_WARNING("VAS traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00181     return true;
00182 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseVAS ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a VAS traffic light.

Definition at line 150 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References NIImporter_Vissim::VissimSingleTypeParser::myRead(), and WRITE_WARNING.

Referenced by parse().

00151                                                                         {
00152     WRITE_WARNING("VAS traffic lights are not supported (lsa=" + toString<int>(lsaid) + ")");
00153     std::string tag;
00154     while (tag!="detektoren") {
00155         tag = myRead(from);
00156     }
00157     return true;
00158 }

bool NIVissimSingleTypeParser_Signalgruppendefinition::parseVSPLUS ( int  id,
const std::string &  name,
int  lsaid,
std::istream &  from 
) [private]

Parses a traffic light group which belongs to a VSPLUS traffic light.

Definition at line 162 of file NIVissimSingleTypeParser_Signalgruppendefinition.cpp.

References WRITE_WARNING.

Referenced by parse().

00163                                                             {
00164     WRITE_WARNING("VSPLUS traffic lights are not supported (lsa="+ toString<int>(lsaid) + ")");
00165     return true;
00166 }

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(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePos(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::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