LCOV - code coverage report
Current view: top level - src/gui - GUIEvent_SimulationEnded.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 4 75.0 %
Date: 2024-05-18 15:37:58 Functions: 1 2 50.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    GUIEvent_SimulationEnded.h
      15             : /// @author  Daniel Krajzewicz
      16             : /// @author  Michael Behrisch
      17             : /// @date    Thu, 19 Jun 2003
      18             : ///
      19             : // Event sent when the the simulation is over
      20             : /****************************************************************************/
      21             : #pragma once
      22             : #include <config.h>
      23             : 
      24             : #include <utils/gui/events/GUIEvent.h>
      25             : #include <utils/common/SUMOTime.h>
      26             : #include <microsim/MSNet.h>
      27             : 
      28             : 
      29             : // ===========================================================================
      30             : // class definitions
      31             : // ===========================================================================
      32             : /**
      33             :  * @class GUIEvent_SimulationEnded
      34             :  * @brief Event sent when the the simulation is over
      35             :  *
      36             :  * Throw from GUIRunThread to GUIApplicationWindow.
      37             :  */
      38             : class GUIEvent_SimulationEnded : public GUIEvent {
      39             : public:
      40             :     /** @brief Constructor
      41             :      * @param[in] reason The reason the simulation has ended
      42             :      * @param[in] step The time step the simulation has ended at
      43             :      */
      44             :     GUIEvent_SimulationEnded(MSNet::SimulationState reason, SUMOTime step)
      45        6369 :         : GUIEvent(GUIEventType::SIMULATION_ENDED), myReason(reason), myStep(step) {}
      46             : 
      47             : 
      48             :     /// @brief Destructor
      49        6369 :     ~GUIEvent_SimulationEnded() { }
      50             : 
      51             : 
      52             :     /** @brief Returns the time step the simulation has ended at
      53             :      * @return The time step the simulation has ended at
      54             :      */
      55             :     SUMOTime getTimeStep() const {
      56           0 :         return myStep;
      57             :     }
      58             : 
      59             : 
      60             :     /** @brief Returns the reason the simulation has ended due
      61             :      * @return The reason the simulation has ended
      62             :      */
      63             :     MSNet::SimulationState getReason() const {
      64       12738 :         return myReason;
      65             :     }
      66             : 
      67             : 
      68             : protected:
      69             :     /// @brief The reason the simulation has ended
      70             :     MSNet::SimulationState myReason;
      71             : 
      72             :     /// @brief The time step the simulation has ended at
      73             :     SUMOTime myStep;
      74             : 
      75             : 
      76             : };

Generated by: LCOV version 1.14