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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <iostream>
33 #include "../NIImporter_Vissim.h"
34 #include "../tempstructs/NIVissimSource.h"
36 
37 
38 // ===========================================================================
39 // method definitions
40 // ===========================================================================
42  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
43 
44 
46 
47 
48 bool
50  std::string id, edgeid;
51  from >> id; // type-checking is missing!
52  std::string tag, name;
53  // override some optional values till q
54  while (tag != "q") {
55  tag = overrideOptionalLabel(from);
56  if (tag == "name") {
57  name = readName(from);
58  } else if (tag == "strecke") {
59  from >> edgeid; // type-checking is missing!
60  }
61  }
62  // read q
63  // bool exact = false;
64  tag = myRead(from);
65  if (tag == "exakt") {
66  // exact = true;
67  tag = myRead(from);
68  }
69  // double q = TplConvert::_2double(tag.c_str());
70  // read the vehicle types
71  from >> tag;
72  int vehicle_combination;
73  from >> vehicle_combination;
74  // check whether optional time information is available
75  tag = readEndSecure(from);
76  double beg, end;
77  beg = -1;
78  end = -1;
79  if (tag == "zeit") {
80  from >> tag;
81  from >> beg;
82  from >> tag;
83  from >> end;
84  }
85  return NIVissimSource::dictionary(id, name, edgeid);
86 }
87 
88 
89 
90 /****************************************************************************/
91 
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)