LCOV - code coverage report
Current view: top level - src/libtraci - LaneArea.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 45 45
Test Date: 2024-10-24 15:46:30 Functions: 84.8 % 33 28

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2012-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    LaneArea.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Mario Krumnow
      17              : /// @author  Jakob Erdmann
      18              : /// @author  Michael Behrisch
      19              : /// @date    30.05.2012
      20              : ///
      21              : // C++ TraCI client API implementation
      22              : /****************************************************************************/
      23              : #include <config.h>
      24              : 
      25              : #define LIBTRACI 1
      26              : #include <libsumo/LaneArea.h>
      27              : #include "Connection.h"
      28              : #include "Domain.h"
      29              : 
      30              : 
      31              : namespace libtraci {
      32              : 
      33              : typedef Domain<libsumo::CMD_GET_LANEAREA_VARIABLE, libsumo::CMD_SET_LANEAREA_VARIABLE> Dom;
      34              : 
      35              : 
      36              : // ===========================================================================
      37              : // static member definitions
      38              : // ===========================================================================
      39              : std::vector<std::string>
      40          148 : LaneArea::getIDList() {
      41          295 :     return Dom::getStringVector(libsumo::TRACI_ID_LIST, "");
      42              : }
      43              : 
      44              : 
      45              : int
      46            3 : LaneArea::getIDCount() {
      47            6 :     return Dom::getInt(libsumo::ID_COUNT, "");
      48              : }
      49              : 
      50              : 
      51              : int
      52           84 : LaneArea::getJamLengthVehicle(const std::string& detID) {
      53           84 :     return Dom::getInt(libsumo::JAM_LENGTH_VEHICLE, detID);
      54              : }
      55              : 
      56              : 
      57              : double
      58           84 : LaneArea::getJamLengthMeters(const std::string& detID) {
      59           84 :     return Dom::getDouble(libsumo::JAM_LENGTH_METERS, detID);
      60              : }
      61              : 
      62              : 
      63              : double
      64           84 : LaneArea::getLastStepMeanSpeed(const std::string& detID) {
      65           84 :     return Dom::getDouble(libsumo::LAST_STEP_MEAN_SPEED, detID);
      66              : }
      67              : 
      68              : 
      69              : std::vector<std::string>
      70          124 : LaneArea::getLastStepVehicleIDs(const std::string& detID) {
      71          124 :     return Dom::getStringVector(libsumo::LAST_STEP_VEHICLE_ID_LIST, detID);
      72              : }
      73              : 
      74              : 
      75              : double
      76           84 : LaneArea::getLastStepOccupancy(const std::string& detID) {
      77           84 :     return Dom::getDouble(libsumo::LAST_STEP_OCCUPANCY, detID);
      78              : }
      79              : 
      80              : 
      81              : double
      82           84 : LaneArea::getPosition(const std::string& detID) {
      83           84 :     return Dom::getDouble(libsumo::VAR_POSITION, detID);
      84              : }
      85              : 
      86              : 
      87              : std::string
      88           84 : LaneArea::getLaneID(const std::string& detID) {
      89           84 :     return Dom::getString(libsumo::VAR_LANE_ID, detID);
      90              : }
      91              : 
      92              : 
      93              : double
      94           84 : LaneArea::getLength(const std::string& detID) {
      95           84 :     return Dom::getDouble(libsumo::VAR_LENGTH, detID);
      96              : }
      97              : 
      98              : 
      99              : int
     100          124 : LaneArea::getLastStepVehicleNumber(const std::string& detID) {
     101          124 :     return Dom::getInt(libsumo::LAST_STEP_VEHICLE_NUMBER, detID);
     102              : }
     103              : 
     104              : 
     105              : int
     106           84 : LaneArea::getLastStepHaltingNumber(const std::string& detID) {
     107           84 :     return Dom::getInt(libsumo::LAST_STEP_VEHICLE_HALTING_NUMBER, detID);
     108              : }
     109              : 
     110              : double
     111          120 : LaneArea::getIntervalOccupancy(const std::string& detID) {
     112          120 :     return Dom::getDouble(libsumo::VAR_INTERVAL_OCCUPANCY, detID);
     113              : }
     114              : 
     115              : double
     116          120 : LaneArea::getIntervalMeanSpeed(const std::string& detID) {
     117          120 :     return Dom::getDouble(libsumo::VAR_INTERVAL_SPEED, detID);
     118              : }
     119              : 
     120              : double
     121          120 : LaneArea::getIntervalMaxJamLengthInMeters(const std::string& detID) {
     122          120 :     return Dom::getDouble(libsumo::VAR_INTERVAL_MAX_JAM_LENGTH_METERS, detID);
     123              : }
     124              : 
     125              : int
     126          120 : LaneArea::getIntervalVehicleNumber(const std::string& detID) {
     127          120 :     return Dom::getInt(libsumo::VAR_INTERVAL_NUMBER, detID);
     128              : }
     129              : 
     130              : double
     131          120 : LaneArea::getLastIntervalOccupancy(const std::string& detID) {
     132          120 :     return Dom::getDouble(libsumo::VAR_LAST_INTERVAL_OCCUPANCY, detID);
     133              : }
     134              : 
     135              : double
     136          120 : LaneArea::getLastIntervalMeanSpeed(const std::string& detID) {
     137          120 :     return Dom::getDouble(libsumo::VAR_LAST_INTERVAL_SPEED, detID);
     138              : }
     139              : 
     140              : double
     141          120 : LaneArea::getLastIntervalMaxJamLengthInMeters(const std::string& detID) {
     142          120 :     return Dom::getDouble(libsumo::VAR_LAST_INTERVAL_MAX_JAM_LENGTH_METERS, detID);
     143              : }
     144              : 
     145              : int
     146          120 : LaneArea::getLastIntervalVehicleNumber(const std::string& detID) {
     147          120 :     return Dom::getInt(libsumo::VAR_LAST_INTERVAL_NUMBER, detID);
     148              : }
     149              : 
     150              : 
     151              : void
     152            5 : LaneArea::overrideVehicleNumber(const std::string& detID, int vehNum) {
     153            5 :     Dom::setInt(libsumo::VAR_VIRTUAL_DETECTION, detID, vehNum);
     154            5 : }
     155              : 
     156            9 : LIBTRACI_PARAMETER_IMPLEMENTATION(LaneArea, LANEAREA)
     157          216 : LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(LaneArea, LANEAREA)
     158              : 
     159              : 
     160              : }  // namespace libtraci
     161              : 
     162              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1