Eclipse SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Laengenverteilungsdefinition.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>
28 #include "../NIImporter_Vissim.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
39 
40 
42 
43 
44 bool
46  // id
47  std::string id;
48  from >> id;
49  // list of points
50  Distribution_Points* points = new Distribution_Points(id);
51  std::string tag;
52  do {
53  tag = readEndSecure(from);
54  if (tag != "DATAEND") {
55  double p1 = StringUtils::toDouble(tag);
56  from >> tag;
57  double p2 = StringUtils::toDouble(tag);
58  points->add(p1, p2);
59  }
60  } while (tag != "DATAEND");
61  DistributionCont::dictionary("length", id, points);
62  return true;
63 }
64 
65 
66 
67 /****************************************************************************/
68 
RandomDistributor::add
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
Definition: RandomDistributor.h:71
DistributionCont::dictionary
static bool dictionary(const std::string &type, const std::string &id, Distribution *d)
Adds a distribution of the given type and name to the container.
Definition: DistributionCont.cpp:35
StringUtils::toDouble
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Definition: StringUtils.cpp:313
NIImporter_Vissim
Importer for networks stored in Vissim format.
Definition: NIImporter_Vissim.h:59
NIVissimSingleTypeParser_Laengenverteilungsdefinition::~NIVissimSingleTypeParser_Laengenverteilungsdefinition
~NIVissimSingleTypeParser_Laengenverteilungsdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp:41
NIVissimSingleTypeParser_Laengenverteilungsdefinition::NIVissimSingleTypeParser_Laengenverteilungsdefinition
NIVissimSingleTypeParser_Laengenverteilungsdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp:37
NIVissimSingleTypeParser_Laengenverteilungsdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp:45
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:680
StringUtils.h
Distribution_Points
Definition: Distribution_Points.h:40
NIVissimSingleTypeParser_Laengenverteilungsdefinition.h
Distribution_Points.h
config.h
PositionVector.h
DistributionCont.h