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 : myTrajectoryIndex = 1;
71 40 : }
72 :
73 : bool move(SUMOTime currentTime);
74 :
75 : private:
76 : /** @brief Constructor
77 : *
78 : * @param[in] holder The vehicle that holds this device
79 : * @param[in] id The ID of the device
80 : */
81 : MSTransportableDevice_FCDReplay(MSTransportable& holder, const std::string& id);
82 :
83 : class MovePedestrians : public Command {
84 : public:
85 : MovePedestrians();
86 : SUMOTime execute(SUMOTime currentTime);
87 : private:
88 : /// @brief Invalidated assignment operator.
89 : MovePedestrians& operator=(const MovePedestrians&) = delete;
90 : };
91 :
92 : private:
93 : const MSDevice_FCDReplay::Trajectory* myTrajectory = nullptr;
94 :
95 : int myTrajectoryIndex = 0;
96 :
97 : /// @brief whether an event for pedestrian processing was added
98 : static bool myAmActive;
99 :
100 : private:
101 : /// @brief Invalidated copy constructor.
102 : MSTransportableDevice_FCDReplay(const MSTransportableDevice_FCDReplay&);
103 :
104 : /// @brief Invalidated assignment operator.
105 : MSTransportableDevice_FCDReplay& operator=(const MSTransportableDevice_FCDReplay&);
106 :
107 :
108 : };
|