Path: blob/main/src/netimport/vissim/tempstructs/NIVissimSource.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-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 NIVissimSource.cpp14/// @author Daniel Krajzewicz15/// @date Sept 200216///17// -------------------18/****************************************************************************/19#include <config.h>202122#include <string>23#include <map>24#include "NIVissimSource.h"2526NIVissimSource::DictType NIVissimSource::myDict;2728NIVissimSource::NIVissimSource(const std::string& id, const std::string& name,29const std::string& edgeid)30: myID(id), myName(name), myEdgeID(edgeid) {}313233NIVissimSource::~NIVissimSource() {}343536bool37NIVissimSource::dictionary(const std::string& id, const std::string& name,38const std::string& edgeid) {39NIVissimSource* o = new NIVissimSource(id, name, edgeid);40if (!dictionary(id, o)) {41delete o;42return false;43}44return true;45}464748bool49NIVissimSource::dictionary(const std::string& id, NIVissimSource* o) {50DictType::iterator i = myDict.find(id);51if (i == myDict.end()) {52myDict[id] = o;53return true;54}55return false;56}575859NIVissimSource*60NIVissimSource::dictionary(const std::string& id) {61DictType::iterator i = myDict.find(id);62if (i == myDict.end()) {63return nullptr;64}65return (*i).second;66}676869void70NIVissimSource::clearDict() {71for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {72delete (*i).second;73}74myDict.clear();75}767778/****************************************************************************/798081