LCOV - code coverage report
Current view: top level - src/traci-server - TraCIServerAPI_MultiEntryExit.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 71.4 % 14 10
Test Date: 2025-12-06 15:35:27 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2025 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    TraCIServerAPI_MultiEntryExit.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    07.05.2009
      18              : ///
      19              : // APIs for getting/setting multi-entry/multi-exit detector values via TraCI
      20              : /****************************************************************************/
      21              : #include <config.h>
      22              : 
      23              : #include <microsim/output/MSDetectorControl.h>
      24              : #include <libsumo/MultiEntryExit.h>
      25              : #include <libsumo/TraCIConstants.h>
      26              : #include <libsumo/StorageHelper.h>
      27              : #include "TraCIServerAPI_MultiEntryExit.h"
      28              : 
      29              : 
      30              : // ===========================================================================
      31              : // method definitions
      32              : // ===========================================================================
      33              : bool
      34            3 : TraCIServerAPI_MultiEntryExit::processSet(TraCIServer& server, tcpip::Storage& inputStorage,
      35              :         tcpip::Storage& outputStorage) {
      36            3 :     std::string warning = ""; // additional description for response
      37              :     // variable
      38            3 :     int variable = inputStorage.readUnsignedByte();
      39            3 :     if (variable != libsumo::VAR_PARAMETER
      40              :        ) {
      41            0 :         return server.writeErrorStatusCmd(libsumo::CMD_SET_MULTIENTRYEXIT_VARIABLE, "Set Multi Entry Exit Detector Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
      42              :     }
      43              :     // id
      44            3 :     std::string id = inputStorage.readString();
      45              :     // process
      46              :     try {
      47              :         switch (variable) {
      48              :             case libsumo::VAR_PARAMETER: {
      49            3 :                 StoHelp::readCompound(inputStorage, 2, "A compound object of size 2 is needed for setting a parameter.");
      50            3 :                 const std::string name = StoHelp::readTypedString(inputStorage, "The name of the parameter must be given as a string.");
      51            3 :                 const std::string value = StoHelp::readTypedString(inputStorage, "The value of the parameter must be given as a string.");
      52            3 :                 libsumo::MultiEntryExit::setParameter(id, name, value);
      53              :                 break;
      54              :             }
      55              :             default:
      56              :                 break;
      57              :         }
      58            0 :     } catch (libsumo::TraCIException& e) {
      59            0 :         return server.writeErrorStatusCmd(libsumo::CMD_SET_MULTIENTRYEXIT_VARIABLE, e.what(), outputStorage);
      60            0 :     }
      61            3 :     server.writeStatusCmd(libsumo::CMD_SET_MULTIENTRYEXIT_VARIABLE, libsumo::RTYPE_OK, warning, outputStorage);
      62              :     return true;
      63              : }
      64              : 
      65              : 
      66              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1