Eclipse SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Signalgeberdefinition.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 //
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <cassert>
25 #include <iostream>
27 #include <utils/common/ToString.h>
30 #include "../NIImporter_Vissim.h"
31 #include "../tempstructs/NIVissimTL.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
39  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
40 
41 
43 
44 
45 bool
47  //
48  int id;
49  from >> id;
50  //
51  std::string tag, name;
52  tag = myRead(from);
53  if (tag == "name") {
54  name = readName(from);
55  tag = myRead(from);
56  }
57  // skip optional "Beschriftung"
58  tag = overrideOptionalLabel(from, tag);
59  //
60  int lsaid;
61  std::vector<int> groupids;
62  if (tag == "lsa") {
63  int groupid;
64  from >> lsaid; // type-checking is missing!
65  from >> tag; // "Gruppe"
66  do {
67  from >> groupid;
68  groupids.push_back(groupid);
69  tag = myRead(from);
70  } while (tag == "oder");
71  //
72  } else {
73  from >> tag; // strecke
74  WRITE_WARNING("Omitting unknown traffic light.");
75  return true;
76  }
77  if (tag == "typ") {
78  from >> tag; // typ-value
79  from >> tag; // "ort"
80  }
81 
82  //
83  from >> tag;
84  int edgeid;
85  from >> edgeid;
86 
87  from >> tag;
88  int laneno;
89  from >> laneno;
90 
91  from >> tag;
92  double position;
93  from >> position;
94  //
95  while (tag != "fahrzeugklassen") {
96  tag = myRead(from);
97  }
98  std::vector<int> assignedVehicleTypes = parseAssignedVehicleTypes(from, "N/A");
99  //
100  NIVissimTL::dictionary(lsaid); // !!! check whether someting is really done here
102  new NIVissimTL::NIVissimTLSignal(id, name, groupids, edgeid,
103  laneno, position, assignedVehicleTypes);
104  if (!NIVissimTL::NIVissimTLSignal::dictionary(lsaid, id, signal)) {
105  throw 1; // !!!
106  }
107  return true;
108 }
109 
110 
111 
112 /****************************************************************************/
113 
ToString.h
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
NIVissimTL::NIVissimTLSignal
Definition: NIVissimTL.h:79
MsgHandler.h
NIImporter_Vissim::VissimSingleTypeParser::readName
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
Definition: NIImporter_Vissim.cpp:797
NIImporter_Vissim
Importer for networks stored in Vissim format.
Definition: NIImporter_Vissim.h:58
NIVissimTL::NIVissimTLSignal::dictionary
static bool dictionary(int lsaid, int id, NIVissimTLSignal *o)
Definition: NIVissimTL.cpp:80
NIVissimTL::dictionary
static bool dictionary(int id, const std::string &type, const std::string &name, SUMOTime absdur, SUMOTime offset)
Definition: NIVissimTL.cpp:320
VectorHelper.h
NIVissimSingleTypeParser_Signalgeberdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:46
NIVissimSingleTypeParser_Signalgeberdefinition::NIVissimSingleTypeParser_Signalgeberdefinition
NIVissimSingleTypeParser_Signalgeberdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:38
StringUtils.h
NIVissimSingleTypeParser_Signalgeberdefinition.h
NIVissimSingleTypeParser_Signalgeberdefinition::~NIVissimSingleTypeParser_Signalgeberdefinition
~NIVissimSingleTypeParser_Signalgeberdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:42
NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes
std::vector< int > parseAssignedVehicleTypes(std::istream &from, const std::string &next)
parses a listof vehicle types assigned to the current data field One should remeber,...
Definition: NIImporter_Vissim.cpp:757
NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel
std::string overrideOptionalLabel(std::istream &from, const std::string &tag="")
overrides the optional label definition; returns the next tag as done by readEndSecure
Definition: NIImporter_Vissim.cpp:727
config.h
NIImporter_Vissim::VissimSingleTypeParser::myRead
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
Definition: NIImporter_Vissim.cpp:670