Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20//
21/****************************************************************************/
22#include <config.h>
23
24#include <iostream>
31
32
33// ===========================================================================
34// method definitions
35// ===========================================================================
38
39
41
42
43bool
45 std::string tag;
46 tag = myRead(from);
47 if (tag == "nureigenestrecke") {
48 return parseOnlyMe(from);
49 } else if (tag == "ort") {
50 return parsePositionDescribed(from);
51 } else if (tag == "nummer") {
52 return parseNumbered(from);
53 }
55 "NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition: format problem");
56 throw 1;
57}
58
59bool
61 std::string tag;
62 from >> tag;
63 return true;
64}
65
66
67bool
69 std::string tag = myRead(from);
71// from >> tag; // "Durch"
72 bool ok = true;
73 do {
74 from >> tag; // "Strecke"
76 //
77 double timegap;
78 from >> timegap;
79
80 from >> tag;
81 double waygap;
82 from >> waygap;
83
84 double vmax = -1;
85 tag = readEndSecure(from);
86 if (tag == "vmax") {
87 from >> vmax;
88 }
89 ok = NIVissimDisturbance::dictionary("", edge, by);
90 if (tag != "DATAEND") {
91 tag = readEndSecure(from);
92 }
93 } while (tag != "DATAEND" && ok);
94 return ok;
95}
96
97
98
99bool
101 //
102 int id;
103 from >> id;
104 //
105 std::string tag;
106 from >> tag;
107 std::string name = readName(from);
108 // skip optional "Beschriftung"
109 while (tag != "ort") {
110 tag = myRead(from);
111 }
112 //
113 from >> tag; // "Strecke"
115 bool ok = true;
116 do {
117 from >> tag; // "Ort"
118 from >> tag; // "Strecke"
120 //
121 double timegap;
122 from >> timegap;
123
124 double waygap;
125 from >> tag;
126 from >> waygap;
127
128 double vmax = -1;
129 tag = readEndSecure(from);
130 if (tag == "vmax") {
131 from >> vmax;
132 }
133
134 ok = NIVissimDisturbance::dictionary(name, edge, by);
135 if (tag != "DATAEND") {
136 tag = readEndSecure(from);
137 }
138 } while (tag != "DATAEND" && ok);
139 return ok;
140}
141
142
143
146 int edgeid;
147 from >> edgeid; // type-checking is missing!
148 //
149 std::string tag;
150 from >> tag;
151 from >> tag;
152 std::vector<int> lanes;
153 if (tag == "ALLE") {
154 //lanes.push_back(1); // !!!
155 } else {
156 lanes.push_back(StringUtils::toInt(tag));
157 }
158 //
159 double position;
160 from >> tag;
161 from >> position;
162 // assigned vehicle types
163 std::vector<int> types;
164 from >> tag;
165 while (tag != "zeitluecke" && tag != "durch" && tag != "DATAEND" && tag != "alle") {
166 tag = readEndSecure(from);
167 if (tag != "DATAEND") {
168 if (tag == "alle") {
169 types.push_back(-1);
170 from >> tag;
171 tag = "alle";
172 } else if (tag != "zeitluecke" && tag != "durch" && tag != "DATAEND") {
173 int tmp = StringUtils::toInt(tag);
174 types.push_back(tmp);
175 }
176 }
177 }
178 return NIVissimExtendedEdgePoint(edgeid, lanes, position, types);
179}
180
181
182/****************************************************************************/
#define WRITE_ERROR(msg)
Definition MsgHandler.h:296
std::string readEndSecure(std::istream &from, const std::string &excl="")
as myRead, but returns "DATAEND" when the current field has ended
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
Importer for networks stored in Vissim format.
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
bool parseNumbered(std::istream &from)
parses a full description of a disturbance
bool parsePositionDescribed(std::istream &from)
parses a disturbance described by its position
bool parse(std::istream &from)
Parses the data type from the given stream.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...