SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 //
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <iostream>
35 #include "../NIImporter_Vissim.h"
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
45  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
46 
47 
49 
50 
51 bool
53  // id
54  std::string id;
55  from >> id;
56  // list of points
57  Distribution_Points* points = new Distribution_Points(id);
58  std::string tag;
59  do {
60  tag = readEndSecure(from);
61  if (tag != "DATAEND") {
62  double p1 = TplConvert::_2double(tag.c_str());
63  from >> tag;
64  double p2 = TplConvert::_2double(tag.c_str());
65  points->add(p1, p2);
66  }
67  } while (tag != "DATAEND");
68  DistributionCont::dictionary("length", id, points);
69  return true;
70 }
71 
72 
73 
74 /****************************************************************************/
75 
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.
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.
bool parse(std::istream &from)
Parses the data type from the given stream.
static double _2double(const E *const data)
converts a char-type array into the double value described by it
Definition: TplConvert.h:297
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.