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 /****************************************************************************/
15 //
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <iostream>
26 #include "../NIImporter_Vissim.h"
27 #include "../tempstructs/NIVissimSource.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
35  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
36 
37 
39 
40 
41 bool
43  std::string id, edgeid;
44  from >> id; // type-checking is missing!
45  std::string tag, name;
46  // override some optional values till q
47  while (tag != "q") {
48  tag = overrideOptionalLabel(from);
49  if (tag == "name") {
50  name = readName(from);
51  } else if (tag == "strecke") {
52  from >> edgeid; // type-checking is missing!
53  }
54  }
55  // read q
56  // bool exact = false;
57  tag = myRead(from);
58  if (tag == "exakt") {
59  // exact = true;
60  tag = myRead(from);
61  }
62  // double q = StringUtils::toDouble(tag);
63  // read the vehicle types
64  from >> tag;
65  int vehicle_combination;
66  from >> vehicle_combination;
67  // check whether optional time information is available
68  tag = readEndSecure(from);
69  double beg, end;
70  beg = -1;
71  end = -1;
72  if (tag == "zeit") {
73  from >> tag;
74  from >> beg;
75  from >> tag;
76  from >> end;
77  }
78  return NIVissimSource::dictionary(id, name, edgeid);
79 }
80 
81 
82 
83 /****************************************************************************/
84 
NIVissimSingleTypeParser_Zuflussdefinition.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
NIVissimSource::dictionary
static bool dictionary(const std::string &id, const std::string &name, const std::string &edgeid)
Definition: NIVissimSource.cpp:39
NIVissimSingleTypeParser_Zuflussdefinition::NIVissimSingleTypeParser_Zuflussdefinition
NIVissimSingleTypeParser_Zuflussdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Zuflussdefinition.cpp:34
NIImporter_Vissim::VissimSingleTypeParser::readEndSecure
std::string readEndSecure(std::istream &from, const std::string &excl="")
as myRead, but returns "DATAEND" when the current field has ended
Definition: NIImporter_Vissim.cpp:679
NIVissimSingleTypeParser_Zuflussdefinition::~NIVissimSingleTypeParser_Zuflussdefinition
~NIVissimSingleTypeParser_Zuflussdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Zuflussdefinition.cpp:38
StringUtils.h
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
NIVissimSingleTypeParser_Zuflussdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Zuflussdefinition.cpp:42