Eclipse SUMO - Simulation of Urban MObility
NIVissimVehicleType.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
25
#include "
NIVissimVehicleType.h
"
26
27
NIVissimVehicleType::DictType
NIVissimVehicleType::myDict
;
28
29
NIVissimVehicleType::NIVissimVehicleType
(
const
std::string& name,
30
const
std::string& category,
const
RGBColor
& color)
31
: myName(name), myCategory(category),
32
myColor(color) {}
33
34
35
NIVissimVehicleType::~NIVissimVehicleType
() {}
36
37
38
39
bool
40
NIVissimVehicleType::dictionary
(
int
id
,
const
std::string& name,
const
std::string& category,
41
const
RGBColor
& color) {
42
NIVissimVehicleType
* o =
new
NIVissimVehicleType
(name, category, color);
43
if
(!
dictionary
(
id
, o)) {
44
delete
o;
45
return
false
;
46
}
47
return
true
;
48
}
49
50
51
bool
52
NIVissimVehicleType::dictionary
(
int
id
,
NIVissimVehicleType
* o) {
53
DictType::iterator i =
myDict
.find(
id
);
54
if
(i ==
myDict
.end()) {
55
myDict
[id] = o;
56
return
true
;
57
}
58
return
false
;
59
}
60
61
62
NIVissimVehicleType
*
63
NIVissimVehicleType::dictionary
(
int
id
) {
64
DictType::iterator i =
myDict
.find(
id
);
65
if
(i ==
myDict
.end()) {
66
return
nullptr
;
67
}
68
return
(*i).second;
69
}
70
71
void
72
NIVissimVehicleType::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
RGBColor
Definition:
RGBColor.h:40
NIVissimVehicleType::NIVissimVehicleType
NIVissimVehicleType(const std::string &name, const std::string &category, const RGBColor &color)
Definition:
NIVissimVehicleType.cpp:29
NIVissimVehicleType::dictionary
static bool dictionary(int id, const std::string &name, const std::string &category, const RGBColor &color)
Definition:
NIVissimVehicleType.cpp:40
config.h
NIVissimVehicleType::~NIVissimVehicleType
~NIVissimVehicleType()
Definition:
NIVissimVehicleType.cpp:35
NIVissimVehicleType.h
NIVissimVehicleType::clearDict
static void clearDict()
Definition:
NIVissimVehicleType.cpp:72
NIVissimVehicleType::myDict
static DictType myDict
Definition:
NIVissimVehicleType.h:54
NIVissimVehicleType::DictType
std::map< int, NIVissimVehicleType * > DictType
Definition:
NIVissimVehicleType.h:53
NIVissimVehicleType
Definition:
NIVissimVehicleType.h:37
src
netimport
vissim
tempstructs
NIVissimVehicleType.cpp
Generated on Sat Nov 23 2019 19:02:54 for Eclipse SUMO - Simulation of Urban MObility by
1.8.13