Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIVissimClosures.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-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/****************************************************************************/
19// -------------------
20/****************************************************************************/
21#include <config.h>
22
23#include <string>
25#include "NIVissimClosures.h"
26
27
29
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
38
39
40bool
41NIVissimClosures::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
54bool
55NIVissimClosures::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
66NIVissimClosures::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
76void
78 for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
79 delete (*i).second;
80 }
81 myDict.clear();
82}
83
84
85/****************************************************************************/
std::map< std::string, NIVissimClosures * > DictType
NIVissimClosures(const std::string &id, int from_node, int to_node, std::vector< int > &overEdges)
static DictType myDict
static bool dictionary(const std::string &id, int from_node, int to_node, std::vector< int > &overEdges)
static void clearDict()