SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.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/NIVissimVehicleClass.h"
35 #include "../tempstructs/NIVissimVehicleClassVector.h"
36 #include "../tempstructs/NIVissimTrafficDescription.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
44  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
45 
46 
48 
49 
50 bool
52  // id
53  int id;
54  from >> id; // type-checking is missing!
55  // name
56  std::string tag;
57  from >> tag;
58  std::string name = readName(from);
59  // assigned vehicle classes
60  tag = myRead(from);
61  if (tag == "temperatur") {
62  tag = myRead(from);
63  tag = myRead(from);
64  }
65  NIVissimVehicleClassVector assignedTypes;
66  while (tag != "DATAEND") {
67  int type;
68  from >> type;
69  double percentage;
70  from >> tag;
71  from >> percentage;
72  int vwish;
73  from >> tag;
74  from >> vwish;
75  assignedTypes.push_back(new NIVissimVehicleClass(vwish));
76  tag = readEndSecure(from, "Fahrzeugtyp");
77  }
78  //
79  return NIVissimTrafficDescription::dictionary(id, name, assignedTypes);
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::vector< NIVissimVehicleClass * > NIVissimVehicleClassVector
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
static bool dictionary(int id, const std::string &name, const NIVissimVehicleClassVector &vehicleTypes)