Eclipse SUMO - Simulation of Urban MObility
NIVissimSource.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
/****************************************************************************/
14
// -------------------
15
/****************************************************************************/
16
17
18
// ===========================================================================
19
// included modules
20
// ===========================================================================
21
#include <
config.h
>
22
23
24
#include <string>
25
#include <map>
26
#include "
NIVissimSource.h
"
27
28
NIVissimSource::DictType
NIVissimSource::myDict
;
29
30
NIVissimSource::NIVissimSource
(
const
std::string&
id
,
const
std::string& name,
31
const
std::string& edgeid)
32
: myID(id), myName(name), myEdgeID(edgeid) {}
33
34
35
NIVissimSource::~NIVissimSource
() {}
36
37
38
bool
39
NIVissimSource::dictionary
(
const
std::string&
id
,
const
std::string& name,
40
const
std::string& edgeid) {
41
NIVissimSource
* o =
new
NIVissimSource
(
id
, name, edgeid);
42
if
(!
dictionary
(
id
, o)) {
43
delete
o;
44
return
false
;
45
}
46
return
true
;
47
}
48
49
50
bool
51
NIVissimSource::dictionary
(
const
std::string&
id
,
NIVissimSource
* o) {
52
DictType::iterator i =
myDict
.find(
id
);
53
if
(i ==
myDict
.end()) {
54
myDict
[id] = o;
55
return
true
;
56
}
57
return
false
;
58
}
59
60
61
NIVissimSource
*
62
NIVissimSource::dictionary
(
const
std::string&
id
) {
63
DictType::iterator i =
myDict
.find(
id
);
64
if
(i ==
myDict
.end()) {
65
return
nullptr
;
66
}
67
return
(*i).second;
68
}
69
70
71
void
72
NIVissimSource::clearDict
() {
73
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
74
delete
(*i).second;
75
}
76
myDict
.clear();
77
}
78
79
80
81
/****************************************************************************/
82
NIVissimSource.h
NIVissimSource::DictType
std::map< std::string, NIVissimSource * > DictType
Definition:
NIVissimSource.h:51
NIVissimSource::dictionary
static bool dictionary(const std::string &id, const std::string &name, const std::string &edgeid)
Definition:
NIVissimSource.cpp:39
NIVissimSource::clearDict
static void clearDict()
Definition:
NIVissimSource.cpp:72
NIVissimSource::myDict
static DictType myDict
Definition:
NIVissimSource.h:52
NIVissimSource::~NIVissimSource
~NIVissimSource()
Definition:
NIVissimSource.cpp:35
NIVissimSource::NIVissimSource
NIVissimSource(const std::string &id, const std::string &name, const std::string &edgeid)
Definition:
NIVissimSource.cpp:30
config.h
NIVissimSource
Definition:
NIVissimSource.h:35
src
netimport
vissim
tempstructs
NIVissimSource.cpp
Generated on Sun Dec 13 2020 08:44:58 for Eclipse SUMO - Simulation of Urban MObility by
1.8.20