Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2013-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 MSTransportableDevice_FCDReplay.h 15 : /// @author Michael Behrisch 16 : /// @date 01.03.2024 17 : /// 18 : // A device which replays recorded floating car data 19 : /****************************************************************************/ 20 : #pragma once 21 : #include <config.h> 22 : 23 : #include <utils/common/Command.h> 24 : #include "MSTransportableDevice.h" 25 : #include "MSDevice_FCDReplay.h" 26 : 27 : 28 : // =========================================================================== 29 : // class definitions 30 : // =========================================================================== 31 : /** 32 : * @class MSTransportableDevice_FCDReplay 33 : * @brief A device which collects info on the vehicle trip (mainly on departure and arrival) 34 : * 35 : * Each device collects departure time, lane and speed and the same for arrival. 36 : * 37 : * @see MSTransportableDevice 38 : */ 39 : class MSTransportableDevice_FCDReplay : public MSTransportableDevice { 40 : public: 41 : /** @brief Inserts MSTransportableDevice_FCDReplay-options 42 : * @param[filled] oc The options container to add the options to 43 : */ 44 : static void insertOptions(OptionsCont& oc); 45 : 46 : 47 : /** @brief Build devices for the given vehicle, if needed 48 : * 49 : * The options are read and evaluated whether a FCD-device shall be built 50 : * for the given vehicle. 51 : * 52 : * The built device is stored in the given vector. 53 : * 54 : * @param[in] v The vehicle for which a device may be built 55 : * @param[filled] into The vector to store the built device in 56 : */ 57 : static void buildDevices(MSTransportable& t, std::vector<MSTransportableDevice*>& into); 58 : 59 : public: 60 : /// @brief Destructor. 61 : ~MSTransportableDevice_FCDReplay(); 62 : 63 : /// @brief return the name for this type of device 64 0 : const std::string deviceName() const { 65 0 : return "fcd-replay"; 66 : } 67 : 68 : void setTrajectory(MSDevice_FCDReplay::Trajectory* const t) { 69 40 : myTrajectory = t; 70 40 : } 71 : 72 : bool move(); 73 : 74 : private: 75 : /** @brief Constructor 76 : * 77 : * @param[in] holder The vehicle that holds this device 78 : * @param[in] id The ID of the device 79 : */ 80 : MSTransportableDevice_FCDReplay(MSTransportable& holder, const std::string& id); 81 : 82 4 : class MovePedestrians : public Command { 83 : public: 84 : SUMOTime execute(SUMOTime currentTime); 85 : private: 86 : /// @brief Invalidated assignment operator. 87 : MovePedestrians& operator=(const MovePedestrians&) = delete; 88 : }; 89 : 90 : private: 91 : MSDevice_FCDReplay::Trajectory* myTrajectory = nullptr; 92 : 93 : /// @brief whether an event for pedestrian processing was added 94 : static bool myAmActive; 95 : 96 : private: 97 : /// @brief Invalidated copy constructor. 98 : MSTransportableDevice_FCDReplay(const MSTransportableDevice_FCDReplay&); 99 : 100 : /// @brief Invalidated assignment operator. 101 : MSTransportableDevice_FCDReplay& operator=(const MSTransportableDevice_FCDReplay&); 102 : 103 : 104 : };