LCOV - code coverage report
Current view: top level - src/od - ODDistrict.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 17 17 100.0 %
Date: 2024-05-03 15:29:52 Functions: 9 9 100.0 %

          Line data    Source code
       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             : /****************************************************************************/
      14             : /// @file    ODDistrict.cpp
      15             : /// @author  Daniel Krajzewicz
      16             : /// @author  Michael Behrisch
      17             : /// @author  Yun-Pang Floetteroed
      18             : /// @date    Sept 2002
      19             : ///
      20             : // A district (origin/destination)
      21             : /****************************************************************************/
      22             : #include <config.h>
      23             : 
      24             : #include <vector>
      25             : #include <string>
      26             : #include <utility>
      27             : #include <utils/common/UtilExceptions.h>
      28             : #include <utils/common/Named.h>
      29             : #include <utils/common/MsgHandler.h>
      30             : #include "ODDistrict.h"
      31             : 
      32             : 
      33             : 
      34             : // ===========================================================================
      35             : // method definitions
      36             : // ===========================================================================
      37         584 : ODDistrict::ODDistrict(const std::string& id)
      38         584 :     : Named(id) {}
      39             : 
      40             : 
      41        1168 : ODDistrict::~ODDistrict() {}
      42             : 
      43             : 
      44             : void
      45         763 : ODDistrict::addSource(const std::string& id, double weight) {
      46         763 :     mySources.add(id, weight, false);
      47         763 : }
      48             : 
      49             : 
      50             : void
      51        1045 : ODDistrict::addSink(const std::string& id, double weight) {
      52        1045 :     mySinks.add(id, weight, false);
      53        1045 : }
      54             : 
      55             : 
      56             : std::string
      57       15963 : ODDistrict::getRandomSource() const {
      58       15963 :     return mySources.get();
      59             : }
      60             : 
      61             : 
      62             : std::string
      63       15963 : ODDistrict::getRandomSink() const {
      64       15963 :     return mySinks.get();
      65             : }
      66             : 
      67             : 
      68             : int
      69       16453 : ODDistrict::sinkNumber() const {
      70       16453 :     return (int) mySinks.getVals().size();
      71             : }
      72             : 
      73             : 
      74             : int
      75       16665 : ODDistrict::sourceNumber() const {
      76       16665 :     return (int) mySources.getVals().size();
      77             : }
      78             : 
      79             : 
      80             : /****************************************************************************/

Generated by: LCOV version 1.14