/****************************************************************************/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 ODDistrict.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Yun-Pang Floetteroed17/// @date Sept 200218///19// A district (origin/destination)20/****************************************************************************/21#include <config.h>2223#include <vector>24#include <string>25#include <utility>26#include <utils/common/UtilExceptions.h>27#include <utils/common/Named.h>28#include <utils/common/MsgHandler.h>29#include "ODDistrict.h"30313233// ===========================================================================34// method definitions35// ===========================================================================36ODDistrict::ODDistrict(const std::string& id)37: Named(id) {}383940ODDistrict::~ODDistrict() {}414243void44ODDistrict::addSource(const std::string& id, double weight) {45mySources.add(id, weight, false);46}474849void50ODDistrict::addSink(const std::string& id, double weight) {51mySinks.add(id, weight, false);52}535455std::string56ODDistrict::getRandomSource() const {57return mySources.get();58}596061std::string62ODDistrict::getRandomSink() const {63return mySinks.get();64}656667int68ODDistrict::sinkNumber() const {69return (int) mySinks.getVals().size();70}717273int74ODDistrict::sourceNumber() const {75return (int) mySources.getVals().size();76}777879/****************************************************************************/808182