Path: blob/main/src/netimport/vissim/tempstructs/NIVissimClosures.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2002-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file NIVissimClosures.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// -------------------19/****************************************************************************/20#include <config.h>2122#include <string>23#include <utils/common/VectorHelper.h>24#include "NIVissimClosures.h"252627NIVissimClosures::DictType NIVissimClosures::myDict;2829NIVissimClosures::NIVissimClosures(const std::string& id,30int from_node, int to_node,31std::vector<int>& overEdges)32: myID(id), myFromNode(from_node), myToNode(to_node),33myOverEdges(overEdges) {}343536NIVissimClosures::~NIVissimClosures() {}373839bool40NIVissimClosures::dictionary(const std::string& id,41int from_node, int to_node,42std::vector<int>& overEdges) {43NIVissimClosures* o = new NIVissimClosures(id, from_node, to_node,44overEdges);45if (!dictionary(id, o)) {46delete o;47return false;48}49return true;50}515253bool54NIVissimClosures::dictionary(const std::string& name, NIVissimClosures* o) {55DictType::iterator i = myDict.find(name);56if (i == myDict.end()) {57myDict[name] = o;58return true;59}60return false;61}626364NIVissimClosures*65NIVissimClosures::dictionary(const std::string& name) {66DictType::iterator i = myDict.find(name);67if (i == myDict.end()) {68return nullptr;69}70return (*i).second;71}72737475void76NIVissimClosures::clearDict() {77for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {78delete (*i).second;79}80myDict.clear();81}828384/****************************************************************************/858687