LCOV - code coverage report
Current view: top level - src/microsim/engine - GenericEngineModel.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 26 0
Test Date: 2024-11-21 15:56:26 Functions: 0.0 % 6 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-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    GenericEngineModel.cpp
      15              : /// @author  Michele Segata
      16              : /// @date    4 Feb 2015
      17              : ///
      18              : // Generic interface for an engine model
      19              : /****************************************************************************/
      20              : 
      21              : #include <config.h>
      22              : 
      23              : #include <iostream>
      24              : #include <utils/common/StringUtils.h>
      25              : #include "GenericEngineModel.h"
      26              : 
      27              : 
      28            0 : void GenericEngineModel::printParameterError(std::string parameter, std::string value) {
      29              :     std::cerr << className << ": invalid value " << value << " for parameter " << parameter << std::endl;
      30            0 : }
      31              : 
      32            0 : void GenericEngineModel::parseParameter(const Parameterised::Map& parameters, std::string parameter, double& value) {
      33              :     Parameterised::Map::const_iterator par = parameters.find(parameter);
      34            0 :     if (par != parameters.end()) {
      35              :         try {
      36            0 :             value = StringUtils::toDouble(par->second);
      37            0 :         } catch (ProcessError&) {
      38            0 :             printParameterError(par->first, par->second);
      39            0 :         }
      40              :     }
      41            0 : }
      42            0 : void GenericEngineModel::parseParameter(const Parameterised::Map& parameters, std::string parameter, int& value) {
      43              :     Parameterised::Map::const_iterator par = parameters.find(parameter);
      44            0 :     if (par != parameters.end()) {
      45              :         try {
      46            0 :             value = StringUtils::toInt(par->second);
      47            0 :         } catch (ProcessError&) {
      48            0 :             printParameterError(par->first, par->second);
      49            0 :         }
      50              :     }
      51            0 : }
      52            0 : void GenericEngineModel::parseParameter(const Parameterised::Map& parameters, std::string parameter, std::string& value) {
      53              :     Parameterised::Map::const_iterator par = parameters.find(parameter);
      54            0 :     if (par != parameters.end()) {
      55            0 :         value = par->second;
      56              :     }
      57            0 : }
      58            0 : void GenericEngineModel::setMaximumAcceleration(double maxAcc) {
      59            0 :     maxAcceleration_mpsps = maxAcc;
      60            0 : }
      61            0 : void GenericEngineModel::setMaximumDeceleration(double maxDec) {
      62            0 :     maxDeceleration_mpsps = maxDec;
      63            0 : }
        

Generated by: LCOV version 2.0-1