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 /****************************************************************************/
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/NIVissimVehicleClass.h"
28 #include "../tempstructs/NIVissimVehicleClassVector.h"
29 #include "../tempstructs/NIVissimTrafficDescription.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
37  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
38 
39 
41 
42 
43 bool
45  // id
46  int id;
47  from >> id; // type-checking is missing!
48  // name
49  std::string tag;
50  from >> tag;
51  std::string name = readName(from);
52  // assigned vehicle classes
53  tag = myRead(from);
54  if (tag == "temperatur") {
55  tag = myRead(from);
56  tag = myRead(from);
57  }
58  NIVissimVehicleClassVector assignedTypes;
59  while (tag != "DATAEND") {
60  int type;
61  from >> type;
62  double percentage;
63  from >> tag;
64  from >> percentage;
65  int vwish;
66  from >> tag;
67  from >> vwish;
68  assignedTypes.push_back(new NIVissimVehicleClass(vwish));
69  tag = readEndSecure(from, "Fahrzeugtyp");
70  }
71  //
72  return NIVissimTrafficDescription::dictionary(id, name, assignedTypes);
73 }
74 
75 
76 
77 /****************************************************************************/
78 
NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp:44
NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.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
NIVissimTrafficDescription::dictionary
static bool dictionary(int id, const std::string &name, const NIVissimVehicleClassVector &vehicleTypes)
Definition: NIVissimTrafficDescription.cpp:54
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_Verkehrszusammensetzungsdefinition::~NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition
~NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp:40
NIVissimVehicleClassVector
std::vector< NIVissimVehicleClass * > NIVissimVehicleClassVector
Definition: NIVissimVehicleClassVector.h:29
StringUtils.h
NIVissimVehicleClass
Definition: NIVissimVehicleClass.h:32
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_Verkehrszusammensetzungsdefinition::NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition
NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp:36