1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    MSVTypeProbe.h
11 /// @author  Tino Morenz
12 /// @author  Daniel Krajzewicz
13 /// @author  Michael Behrisch
14 /// @date    Wed, 24.10.2007
15 /// @version $Id$
16 ///
17 // Writes positions of vehicles that have a certain (named) type
18 /****************************************************************************/
19 #ifndef MSVTypeProbe_h
20 #define MSVTypeProbe_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <utils/common/Command.h>
30 #include <utils/iodevices/OutputDevice.h>
31 #include <utils/common/Named.h>
32 #include <utils/common/SUMOTime.h>
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 /**
39  * @class MSVTypeProbe
40  * @brief Writes positions of vehicles that have a certain (named) type
41  *
42  * This device allows to log the data of all running vehicles of the
43  *  specified vehicle type, i.e. vehicle id, edge, lane=, position
44  *  on lane, x/y coordinates and speed.
45  *
46  * A frequency can be specified to generate the output in certain intervals,
47  *  (e.g. every 10 seconds).
48  *
49  * @see Command
50  * @see Named
51  */
52 
53 class MSVTypeProbe : public Named, public Command {
54 public:
55     /** @brief Constructor
56      *
57      * @param[in] id The id of the vehicle type probe
58      * @param[in] vType The vtype of which vehicles to report must be ("" for all vehicles)
59      * @param[in] od The output device to write into
60      * @param[in] frequency The output frequency [ms]
61      */
62     MSVTypeProbe(const std::string& id, const std::string& vType,
63                  OutputDevice& od, SUMOTime frequency);
64 
65 
66     /// @brief Destructor
67     virtual ~MSVTypeProbe();
68 
69 
70 
71     /// @name Derived from Command
72     /// @{
73 
74     /** @brief Writes values into the given stream
75      *
76      * This method goes through all runing vehicles; if a vehicle
77      *  has a type with the same id as the wished one, it is reported.
78      * When the type "" is wished, all vehicles are reported
79      *
80      * @param[in] currentTime The current simulation time (unused)
81      * @return Always myFrequency (time till next output)
82      * @see Command
83      */
84     SUMOTime execute(SUMOTime currentTime);
85     /// @}
86 
87 
88 private:
89     /// @brief The id of the vehicle type vehicles must have to be reported
90     std::string myVType;
91 
92     /// @brief The device to write into
93     OutputDevice& myOutputDevice;
94 
95     /// @brief The frequency of reporting
96     SUMOTime myFrequency;
97 
98 
99 private:
100     /// @brief Invalidated copy constructor.
101     MSVTypeProbe(const MSVTypeProbe&);
102 
103     /// @brief Invalidated assignment operator.
104     MSVTypeProbe& operator=(const MSVTypeProbe&);
105 
106 
107 };
108 
109 #endif
110 
111 /****************************************************************************/
112 
113