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.dev/sumo
3
// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
18
// -------------------
19
/****************************************************************************/
20
#include <config.h>
21
22
23
#include "
NIVissimVehicleType.h
"
24
25
NIVissimVehicleType::DictType
NIVissimVehicleType::myDict
;
26
27
NIVissimVehicleType::NIVissimVehicleType
(
const
std::string& name,
28
const
std::string& category,
const
RGBColor
& color)
29
: myName(name), myCategory(category),
30
myColor(color) {}
31
32
33
NIVissimVehicleType::~NIVissimVehicleType
() {}
34
35
36
37
bool
38
NIVissimVehicleType::dictionary
(
int
id
,
const
std::string& name,
const
std::string& category,
39
const
RGBColor
& color) {
40
NIVissimVehicleType
* o =
new
NIVissimVehicleType
(name, category, color);
41
if
(!
dictionary
(
id
, o)) {
42
delete
o;
43
return
false
;
44
}
45
return
true
;
46
}
47
48
49
bool
50
NIVissimVehicleType::dictionary
(
int
id
,
NIVissimVehicleType
* o) {
51
DictType::iterator i =
myDict
.find(
id
);
52
if
(i ==
myDict
.end()) {
53
myDict
[id] = o;
54
return
true
;
55
}
56
return
false
;
57
}
58
59
60
NIVissimVehicleType
*
61
NIVissimVehicleType::dictionary
(
int
id
) {
62
DictType::iterator i =
myDict
.find(
id
);
63
if
(i ==
myDict
.end()) {
64
return
nullptr
;
65
}
66
return
(*i).second;
67
}
68
69
void
70
NIVissimVehicleType::clearDict
() {
71
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
72
delete
(*i).second;
73
}
74
myDict
.clear();
75
}
76
77
78
/****************************************************************************/
NIVissimVehicleType.h
NIVissimVehicleType
Definition:
NIVissimVehicleType.h:34
NIVissimVehicleType::dictionary
static bool dictionary(int id, const std::string &name, const std::string &category, const RGBColor &color)
Definition:
NIVissimVehicleType.cpp:38
NIVissimVehicleType::~NIVissimVehicleType
~NIVissimVehicleType()
Definition:
NIVissimVehicleType.cpp:33
NIVissimVehicleType::clearDict
static void clearDict()
Definition:
NIVissimVehicleType.cpp:70
NIVissimVehicleType::NIVissimVehicleType
NIVissimVehicleType(const std::string &name, const std::string &category, const RGBColor &color)
Definition:
NIVissimVehicleType.cpp:27
NIVissimVehicleType::myDict
static DictType myDict
Definition:
NIVissimVehicleType.h:51
NIVissimVehicleType::DictType
std::map< int, NIVissimVehicleType * > DictType
Definition:
NIVissimVehicleType.h:50
RGBColor
Definition:
RGBColor.h:38
src
netimport
vissim
tempstructs
NIVissimVehicleType.cpp
Generated on Sun Jun 2 2024 00:09:08 for Eclipse SUMO - Simulation of Urban MObility by
1.9.1