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 /****************************************************************************/
16 //
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <cassert>
26 #include <iostream>
28 #include <utils/common/ToString.h>
31 #include "../NIImporter_Vissim.h"
32 #include "../tempstructs/NIVissimTL.h"
34 
35 
36 // ===========================================================================
37 // method definitions
38 // ===========================================================================
40  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
41 
42 
44 
45 
46 bool
48  //
49  int id;
50  from >> id;
51  //
52  std::string tag, name;
53  tag = myRead(from);
54  if (tag == "name") {
55  name = readName(from);
56  tag = myRead(from);
57  }
58  // skip optional "Beschriftung"
59  tag = overrideOptionalLabel(from, tag);
60  //
61  int lsaid;
62  std::vector<int> groupids;
63  if (tag == "lsa") {
64  int groupid;
65  from >> lsaid; // type-checking is missing!
66  from >> tag; // "Gruppe"
67  do {
68  from >> groupid;
69  groupids.push_back(groupid);
70  tag = myRead(from);
71  } while (tag == "oder");
72  //
73  } else {
74  from >> tag; // strecke
75  WRITE_WARNING("Omitting unknown traffic light.");
76  return true;
77  }
78  if (tag == "typ") {
79  from >> tag; // typ-value
80  from >> tag; // "ort"
81  }
82 
83  //
84  from >> tag;
85  int edgeid;
86  from >> edgeid;
87 
88  from >> tag;
89  int laneno;
90  from >> laneno;
91 
92  from >> tag;
93  double position;
94  from >> position;
95  //
96  while (tag != "fahrzeugklassen") {
97  tag = myRead(from);
98  }
99  std::vector<int> assignedVehicleTypes = parseAssignedVehicleTypes(from, "N/A");
100  //
101  NIVissimTL::dictionary(lsaid); // !!! check whether someting is really done here
103  new NIVissimTL::NIVissimTLSignal(id, name, groupids, edgeid,
104  laneno, position, assignedVehicleTypes);
105  if (!NIVissimTL::NIVissimTLSignal::dictionary(lsaid, id, signal)) {
106  throw 1; // !!!
107  }
108  return true;
109 }
110 
111 
112 
113 /****************************************************************************/
114 
ToString.h
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
NIVissimTL::NIVissimTLSignal
Definition: NIVissimTL.h:80
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:798
NIImporter_Vissim
Importer for networks stored in Vissim format.
Definition: NIImporter_Vissim.h:59
NIVissimTL::NIVissimTLSignal::dictionary
static bool dictionary(int lsaid, int id, NIVissimTLSignal *o)
Definition: NIVissimTL.cpp:81
NIVissimTL::dictionary
static bool dictionary(int id, const std::string &type, const std::string &name, SUMOTime absdur, SUMOTime offset)
Definition: NIVissimTL.cpp:321
VectorHelper.h
NIVissimSingleTypeParser_Signalgeberdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:47
NIVissimSingleTypeParser_Signalgeberdefinition::NIVissimSingleTypeParser_Signalgeberdefinition
NIVissimSingleTypeParser_Signalgeberdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:39
StringUtils.h
NIVissimSingleTypeParser_Signalgeberdefinition.h
NIVissimSingleTypeParser_Signalgeberdefinition::~NIVissimSingleTypeParser_Signalgeberdefinition
~NIVissimSingleTypeParser_Signalgeberdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Signalgeberdefinition.cpp:43
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:758
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:728
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:671