LCOV - code coverage report
Current view: top level - src/microsim/actions - Command_SaveTLCoupledDet.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 15 15
Test Date: 2024-11-22 15:46:21 Functions: 100.0 % 4 4

            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    Command_SaveTLCoupledDet.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    15 Feb 2004
      18              : ///
      19              : // Writes e2 state on each tls switch
      20              : /****************************************************************************/
      21              : #include <config.h>
      22              : 
      23              : #include "Command_SaveTLCoupledDet.h"
      24              : #include <microsim/MSNet.h>
      25              : #include <microsim/traffic_lights/MSTrafficLightLogic.h>
      26              : #include <microsim/MSEventControl.h>
      27              : #include <microsim/output/MSDetectorFileOutput.h>
      28              : #include <utils/common/UtilExceptions.h>
      29              : #include <utils/common/MsgHandler.h>
      30              : #include <utils/iodevices/OutputDevice.h>
      31              : 
      32              : 
      33              : // ===========================================================================
      34              : // method definitions
      35              : // ===========================================================================
      36          559 : Command_SaveTLCoupledDet::Command_SaveTLCoupledDet(MSTLLogicControl::TLSLogicVariants& tlls,
      37          559 :         MSDetectorFileOutput* dtf, SUMOTime begin, OutputDevice& device)
      38          559 :     : myDevice(device), myLogics(tlls), myDetector(dtf),
      39          559 :       myStartTime(begin) {
      40          559 :     tlls.addSwitchCommand(this);
      41          559 :     dtf->writeXMLDetectorProlog(device);
      42          559 : }
      43              : 
      44              : 
      45         1110 : Command_SaveTLCoupledDet::~Command_SaveTLCoupledDet() {
      46         1110 : }
      47              : 
      48              : 
      49              : void
      50        54436 : Command_SaveTLCoupledDet::execute() {
      51        54436 :     SUMOTime end = MSNet::getInstance()->getCurrentTimeStep();
      52        54436 :     if (myStartTime != end) {
      53        53920 :         myDetector->writeXMLOutput(myDevice, myStartTime, end);
      54        53920 :         myStartTime = end;
      55              :     }
      56        54436 : }
      57              : 
      58              : 
      59              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1