Eclipse SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Zuflussdefinition.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 <iostream>
27 #include "../NIImporter_Vissim.h"
28 #include "../tempstructs/NIVissimSource.h"
30 
31 
32 // ===========================================================================
33 // method definitions
34 // ===========================================================================
36  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
37 
38 
40 
41 
42 bool
44  std::string id, edgeid;
45  from >> id; // type-checking is missing!
46  std::string tag, name;
47  // override some optional values till q
48  while (tag != "q") {
49  tag = overrideOptionalLabel(from);
50  if (tag == "name") {
51  name = readName(from);
52  } else if (tag == "strecke") {
53  from >> edgeid; // type-checking is missing!
54  }
55  }
56  // read q
57  // bool exact = false;
58  tag = myRead(from);
59  if (tag == "exakt") {
60  // exact = true;
61  tag = myRead(from);
62  }
63  // double q = StringUtils::toDouble(tag);
64  // read the vehicle types
65  from >> tag;
66  int vehicle_combination;
67  from >> vehicle_combination;
68  // check whether optional time information is available
69  tag = readEndSecure(from);
70  double beg, end;
71  beg = -1;
72  end = -1;
73  if (tag == "zeit") {
74  from >> tag;
75  from >> beg;
76  from >> tag;
77  from >> end;
78  }
79  return NIVissimSource::dictionary(id, name, edgeid);
80 }
81 
82 
83 
84 /****************************************************************************/
85 
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
std::string readEndSecure(std::istream &from, const std::string &excl="")
as myRead, but returns "DATAEND" when the current field has ended
Importer for networks stored in Vissim format.
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
bool parse(std::istream &from)
Parses the data type from the given stream.
NIVissimSingleTypeParser_Zuflussdefinition(NIImporter_Vissim &parent)
Constructor.
std::string overrideOptionalLabel(std::istream &from, const std::string &tag="")
overrides the optional label definition; returns the next tag as done by readEndSecure ...
static bool dictionary(const std::string &id, const std::string &name, const std::string &edgeid)