Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIVissimVehTypeClass.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-2023 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
/****************************************************************************/
19
// -------------------
20
/****************************************************************************/
21
#include <config.h>
22
23
#include <string>
24
#include <
utils/common/RGBColor.h
>
25
#include <
utils/common/VectorHelper.h
>
26
#include "
NIVissimVehTypeClass.h
"
27
28
29
NIVissimVehTypeClass::DictType
NIVissimVehTypeClass::myDict
;
30
31
NIVissimVehTypeClass::NIVissimVehTypeClass
(
int
id
,
32
const
std::string& name,
33
const
RGBColor
& color,
34
std::vector<int>& types)
35
: myID(id), myName(name), myColor(color), myTypes(types) {}
36
37
NIVissimVehTypeClass::~NIVissimVehTypeClass
() {}
38
39
40
bool
41
NIVissimVehTypeClass::dictionary
(
int
id
,
const
std::string& name,
42
const
RGBColor
& color,
43
std::vector<int>& types) {
44
NIVissimVehTypeClass
* o =
new
NIVissimVehTypeClass
(
id
, name, color, types);
45
if
(!
dictionary
(
id
, o)) {
46
delete
o;
47
return
false
;
48
}
49
return
true
;
50
}
51
52
53
54
55
bool
56
NIVissimVehTypeClass::dictionary
(
int
name,
NIVissimVehTypeClass
* o) {
57
DictType::iterator i =
myDict
.find(name);
58
if
(i ==
myDict
.end()) {
59
myDict
[name] = o;
60
return
true
;
61
}
62
return
false
;
63
}
64
65
66
NIVissimVehTypeClass
*
67
NIVissimVehTypeClass::dictionary
(
int
name) {
68
DictType::iterator i =
myDict
.find(name);
69
if
(i ==
myDict
.end()) {
70
return
nullptr
;
71
}
72
return
(*i).second;
73
}
74
75
76
void
77
NIVissimVehTypeClass::clearDict
() {
78
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
79
delete
(*i).second;
80
}
81
myDict
.clear();
82
}
83
84
85
/****************************************************************************/
NIVissimVehTypeClass.h
RGBColor.h
VectorHelper.h
NIVissimVehTypeClass
Definition
NIVissimVehTypeClass.h:35
NIVissimVehTypeClass::DictType
std::map< int, NIVissimVehTypeClass * > DictType
Definition
NIVissimVehTypeClass.h:52
NIVissimVehTypeClass::clearDict
static void clearDict()
Definition
NIVissimVehTypeClass.cpp:77
NIVissimVehTypeClass::dictionary
static bool dictionary(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
Definition
NIVissimVehTypeClass.cpp:41
NIVissimVehTypeClass::~NIVissimVehTypeClass
~NIVissimVehTypeClass()
Definition
NIVissimVehTypeClass.cpp:37
NIVissimVehTypeClass::NIVissimVehTypeClass
NIVissimVehTypeClass(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
Definition
NIVissimVehTypeClass.cpp:31
NIVissimVehTypeClass::myDict
static DictType myDict
Definition
NIVissimVehTypeClass.h:53
RGBColor
Definition
RGBColor.h:38
src
netimport
vissim
tempstructs
NIVissimVehTypeClass.cpp
Generated on Mon Oct 28 2024 15:20:00 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8