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