SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
//
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <iostream>
34
#include <
utils/common/TplConvert.h
>
35
#include <
utils/common/MsgHandler.h
>
36
#include "../NIImporter_Vissim.h"
37
#include "../tempstructs/NIVissimTL.h"
38
#include "
NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h
"
39
40
#ifdef CHECK_MEMORY_LEAKS
41
#include <
foreign/nvwa/debug_new.h
>
42
#endif // CHECK_MEMORY_LEAKS
43
44
45
// ===========================================================================
46
// method definitions
47
// ===========================================================================
48
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::NIVissimSingleTypeParser_Lichtsignalanlagendefinition
(
NIImporter_Vissim
& parent)
49
:
NIImporter_Vissim
::VissimSingleTypeParser(parent) {}
50
51
52
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::~NIVissimSingleTypeParser_Lichtsignalanlagendefinition
() {}
53
54
55
bool
56
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parse
(std::istream& from) {
57
//
58
int
id;
59
from >> id;
60
//
61
std::string tag, name;
62
tag =
myRead
(from);
63
if
(tag ==
"name"
) {
64
name =
readName
(from);
65
tag =
myRead
(from);
66
}
67
// type
68
std::string type;
69
type =
myRead
(from);
70
if
(type ==
"festzeit"
) {
71
return
parseFixedTime
(
id
, name, from);
72
}
73
if
(type ==
"vas"
) {
74
return
parseVAS
(
id
, name, from);
75
}
76
if
(type ==
"vsplus"
) {
77
return
parseRestActuated
(
id
, name, from, type);
78
}
79
if
(type ==
"trends"
) {
80
return
parseRestActuated
(
id
, name, from, type);
81
}
82
if
(type ==
"vap"
) {
83
return
parseRestActuated
(
id
, name, from, type);
84
}
85
if
(type ==
"tl"
) {
86
return
parseRestActuated
(
id
, name, from, type);
87
}
88
if
(type ==
"pos"
) {
89
return
parseRestActuated
(
id
, name, from, type);
90
}
91
if
(type ==
"nema"
) {
92
return
parseRestActuated
(
id
, name, from, type);
93
}
94
if
(type ==
"extern"
) {
95
return
parseRestActuated
(
id
, name, from, type);
96
}
97
WRITE_ERROR
(
"Unsupported LSA-Type '"
+ type +
"' occured."
);
98
return
false
;
99
}
100
101
102
bool
103
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseFixedTime
(
104
int
id
, std::string name, std::istream& from) {
105
std::string type =
"festzeit"
;
106
std::string tag;
107
from >> tag;
108
//
109
SUMOReal
absdur;
110
from >> absdur;
// type-checking is missing!
111
//
112
tag =
readEndSecure
(from);
113
SUMOReal
offset = 0;
114
if
(tag ==
"versatz"
) {
115
from >> offset;
// type-checking is missing!
116
}
117
if
(tag !=
"szpkonfdatei"
&& tag !=
"DATAEND"
&& tag !=
"progdatei"
) {
118
tag =
readEndSecure
(from);
119
if
(tag ==
"szpkonfdatei"
|| tag ==
"progdatei"
) {
120
type =
"festzeit_fake"
;
121
}
122
}
123
return
NIVissimTL::dictionary
(
id
, type, name, (
SUMOTime
) absdur, (
SUMOTime
) offset);
124
}
125
126
127
bool
128
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseVAS
(
129
int
id
, std::string name, std::istream& from) {
130
std::string tag;
131
from >> tag;
132
//
133
SUMOReal
absdur;
134
from >> absdur;
// type-checking is missing!
135
//
136
tag =
readEndSecure
(from);
137
SUMOReal
offset = 0;
138
if
(tag ==
"versatz"
) {
139
from >> offset;
// type-checking is missing!
140
}
141
return
NIVissimTL::dictionary
(
id
,
"vas"
, name, (
SUMOTime
) absdur, (
SUMOTime
) offset);
142
}
143
144
145
bool
146
NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated
(
147
int
id
, std::string name, std::istream& from,
const
std::string& type) {
148
std::string tag;
149
from >> tag;
150
//
151
SUMOReal
absdur;
152
from >> absdur;
// type-checking is missing!
153
//
154
tag =
readEndSecure
(from);
155
SUMOReal
offset = 0;
156
if
(tag ==
"versatz"
) {
157
from >> offset;
// type-checking is missing!
158
}
159
while
(tag !=
"datei"
) {
160
tag =
myRead
(from);
161
}
162
return
NIVissimTL::dictionary
(
id
, type, name, (
SUMOTime
) absdur, (
SUMOTime
) offset);
163
}
164
165
166
167
/****************************************************************************/
168
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
netimport
vissim
typeloader
NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp
Generated on Sun Jun 16 2013 07:08:05 for SUMO - Simulation of Urban MObility by
1.8.1.2