LCOV - code coverage report
Current view: top level - src/microsim/devices - MSDevice_FCD.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 13 13
Test Date: 2026-04-16 16:39:47 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2013-2026 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    MSDevice_FCD.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @date    11.06.2013
      18              : ///
      19              : // A device which records floating car data
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include "MSVehicleDevice.h"
      25              : #include <microsim/MSVehicle.h>
      26              : #include <utils/common/SUMOTime.h>
      27              : #include <utils/shapes/SUMOPolygon.h>
      28              : 
      29              : // ===========================================================================
      30              : // class declarations
      31              : // ===========================================================================
      32              : class SUMOVehicle;
      33              : class SUMOTrafficObject;
      34              : 
      35              : 
      36              : // ===========================================================================
      37              : // class definitions
      38              : // ===========================================================================
      39              : /**
      40              :  * @class MSDevice_FCD
      41              :  * @brief A device which collects info on the vehicle trip (mainly on departure and arrival)
      42              :  *
      43              :  * Each device collects departure time, lane and speed and the same for arrival.
      44              :  *
      45              :  * @see MSDevice
      46              :  */
      47              : class MSDevice_FCD : public MSVehicleDevice {
      48              : public:
      49              :     /** @brief Inserts MSDevice_FCD-options
      50              :      * @param[filled] oc The options container to add the options to
      51              :      */
      52              :     static void insertOptions(OptionsCont& oc);
      53              : 
      54              :     /** @brief Build devices for the given vehicle, if needed
      55              :      *
      56              :      * The options are read and evaluated whether a FCD-device shall be built
      57              :      *  for the given vehicle.
      58              :      *
      59              :      * The built device is stored in the given vector.
      60              :      *
      61              :      * @param[in] v The vehicle for which a device may be built
      62              :      * @param[filled] into The vector to store the built device in
      63              :      */
      64              :     static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
      65              : 
      66              : public:
      67              :     /// @brief Destructor.
      68              :     ~MSDevice_FCD();
      69              : 
      70        10777 :     bool notifyEnter(SUMOTrafficObject& /*veh*/, MSMoveReminder::Notification /*reason*/, const MSLane* /*enteredLane*/) {
      71        10777 :         return false;
      72              :     }
      73              : 
      74           10 :     void saveState(OutputDevice& /* out */) const {
      75           10 :     }
      76              : 
      77              :     /// @brief return the name for this type of device
      78         1305 :     const std::string deviceName() const {
      79         1305 :         return "fcd";
      80              :     }
      81              : 
      82              :     static inline SUMOTime getBegin() {
      83      5044583 :         return myBegin;
      84              :     }
      85              : 
      86              :     static inline SUMOTime getPeriod() {
      87      5044583 :         return myPeriod;
      88              :     }
      89              : 
      90              :     static inline bool useGeo() {
      91      4986881 :         return myUseGeo;
      92              :     }
      93              : 
      94              :     static inline bool useUTM() {
      95      4986881 :         return myUseUTM;
      96              :     }
      97              : 
      98              :     static inline double getMaxLeaderDistance() {
      99      4986881 :         return myMaxLeaderDistance;
     100              :     }
     101              : 
     102              :     static inline const std::vector<std::string>& getParamsToWrite() {
     103              :         return myParamsToWrite;
     104              :     }
     105              : 
     106              :     static inline double getRadius() {
     107      4986881 :         return myRadius;
     108              :     }
     109              : 
     110              :     static inline const std::set<const MSEdge*>& getEdgeFilter() {
     111              :         return myEdgeFilter;
     112              :     }
     113              : 
     114              :     static inline const SumoXMLAttrMask& getWrittenAttributes() {
     115              :         return myWrittenAttributes;
     116              :     }
     117              : 
     118              :     /// @brief initialize edge filter and attribute mask (once)
     119              :     static void initOnce();
     120              : 
     121              :     /// @brief resets the edge filter
     122              :     static void cleanup();
     123              : 
     124              :     /// @brief checks if in polygon
     125              :     static bool shapeFilter(const SUMOTrafficObject* veh);
     126              : 
     127              :     /// @brief is there a filter based on shapes?
     128              :     inline static bool hasShapeFilter() {
     129      4986881 :         return myShapeFilterDesired;
     130              :     }
     131              : 
     132              : private:
     133              :     /** @brief Constructor
     134              :      *
     135              :      * @param[in] holder The vehicle that holds this device
     136              :      * @param[in] id The ID of the device
     137              :      */
     138              :     MSDevice_FCD(SUMOVehicle& holder, const std::string& id);
     139              : 
     140              :     /// @brief begin time
     141              :     static SUMOTime myBegin;
     142              :     static SUMOTime myPeriod;
     143              :     static bool myUseGeo;
     144              :     static bool myUseUTM;
     145              :     static double myMaxLeaderDistance;
     146              :     static std::vector<std::string> myParamsToWrite;
     147              :     static double myRadius;
     148              : 
     149              :     /// @brief edge filter for FCD output
     150              :     static std::set<const MSEdge*> myEdgeFilter;
     151              :     static bool myEdgeFilterInitialized;
     152              : 
     153              :     /// @brief polygon spatial filter for FCD output
     154              :     static std::vector<PositionVector> myShape4Filters;
     155              :     static bool myShapeFilterInitialized;
     156              :     static bool myShapeFilterDesired;
     157              : 
     158              :     /// @brief bit mask for checking attributes to be written
     159              :     static SumoXMLAttrMask myWrittenAttributes;
     160              :     static SumoXMLAttrMask getDefaultMask();
     161              : 
     162              : private:
     163              :     /// @brief Invalidated copy constructor.
     164              :     MSDevice_FCD(const MSDevice_FCD&);
     165              : 
     166              :     /// @brief Invalidated assignment operator.
     167              :     MSDevice_FCD& operator=(const MSDevice_FCD&);
     168              : 
     169              :     static void buildShapeFilter();
     170              : 
     171              : 
     172              : };
        

Generated by: LCOV version 2.0-1