Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netimport/vissim/tempstructs/NIVissimClosures.cpp
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-2025 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
/****************************************************************************/
14
/// @file NIVissimClosures.cpp
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date Sept 2002
18
///
19
// -------------------
20
/****************************************************************************/
21
#include <config.h>
22
23
#include <string>
24
#include <utils/common/VectorHelper.h>
25
#include "NIVissimClosures.h"
26
27
28
NIVissimClosures::DictType NIVissimClosures::myDict;
29
30
NIVissimClosures::NIVissimClosures(const std::string& id,
31
int from_node, int to_node,
32
std::vector<int>& overEdges)
33
: myID(id), myFromNode(from_node), myToNode(to_node),
34
myOverEdges(overEdges) {}
35
36
37
NIVissimClosures::~NIVissimClosures() {}
38
39
40
bool
41
NIVissimClosures::dictionary(const std::string& id,
42
int from_node, int to_node,
43
std::vector<int>& overEdges) {
44
NIVissimClosures* o = new NIVissimClosures(id, from_node, to_node,
45
overEdges);
46
if (!dictionary(id, o)) {
47
delete o;
48
return false;
49
}
50
return true;
51
}
52
53
54
bool
55
NIVissimClosures::dictionary(const std::string& name, NIVissimClosures* o) {
56
DictType::iterator i = myDict.find(name);
57
if (i == myDict.end()) {
58
myDict[name] = o;
59
return true;
60
}
61
return false;
62
}
63
64
65
NIVissimClosures*
66
NIVissimClosures::dictionary(const std::string& name) {
67
DictType::iterator i = myDict.find(name);
68
if (i == myDict.end()) {
69
return nullptr;
70
}
71
return (*i).second;
72
}
73
74
75
76
void
77
NIVissimClosures::clearDict() {
78
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
79
delete (*i).second;
80
}
81
myDict.clear();
82
}
83
84
85
/****************************************************************************/
86
87