Eclipse 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-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/NIVissimVehicleClass.h"
29 #include "../tempstructs/NIVissimVehicleClassVector.h"
30 #include "../tempstructs/NIVissimTrafficDescription.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
39 
40 
42 
43 
44 bool
46  // id
47  int id;
48  from >> id; // type-checking is missing!
49  // name
50  std::string tag;
51  from >> tag;
52  std::string name = readName(from);
53  // assigned vehicle classes
54  tag = myRead(from);
55  if (tag == "temperatur") {
56  tag = myRead(from);
57  tag = myRead(from);
58  }
59  NIVissimVehicleClassVector assignedTypes;
60  while (tag != "DATAEND") {
61  int type;
62  from >> type;
63  double percentage;
64  from >> tag;
65  from >> percentage;
66  int vwish;
67  from >> tag;
68  from >> vwish;
69  assignedTypes.push_back(new NIVissimVehicleClass(vwish));
70  tag = readEndSecure(from, "Fahrzeugtyp");
71  }
72  //
73  return NIVissimTrafficDescription::dictionary(id, name, assignedTypes);
74 }
75 
76 
77 
78 /****************************************************************************/
79 
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)