Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSDetectorFileOutput.h
Go to the documentation of this file.
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/****************************************************************************/
22// Base of value-generating classes (detectors)
23/****************************************************************************/
24#pragma once
25#include <config.h>
26
27#include <string>
28#include <set>
29
30#include <utils/common/Named.h>
33#include <microsim/MSNet.h>
34
35
36// ===========================================================================
37// class declarations
38// ===========================================================================
39class OutputDevice;
42class MSTransportable;
43class MSEdge;
44
45
46// ===========================================================================
47// class definitions
48// ===========================================================================
54
63public:
65 MSDetectorFileOutput(const std::string& id, const std::string& vTypes, const std::string& nextEdges = "", const int detectPersons = false);
66
69
70
73
80 virtual void writeXMLOutput(OutputDevice& dev,
81 SUMOTime startTime, SUMOTime stopTime) = 0;
82
83
92 virtual void writeXMLDetectorProlog(OutputDevice& dev) const = 0;
93
94
102 virtual void reset() { }
103
104
109 virtual void detectorUpdate(const SUMOTime step) {
110 UNUSED_PARAMETER(step);
111 }
112
113
120 return 0;
121 }
122
123
129 bool vehicleApplies(const SUMOTrafficObject& veh) const;
130
131 bool personApplies(const MSTransportable& p, int dir) const;
132
133
138 bool isTyped() const {
139 return !myVehicleTypes.empty();
140 }
141
142 const std::set<std::string>& getVehicleTypes() const {
143 return myVehicleTypes;
144 }
145
146 inline bool detectPersons() const {
147 return myDetectPersons != 0;
148 }
149
151 virtual void clearState(SUMOTime /*step*/) {};
152
153protected:
155 std::set<std::string> myVehicleTypes;
156
158 std::vector<const MSEdge*> myNextEdges;
159
162
163private:
166
169
170
171};
long long int SUMOTime
Definition GUI.h:36
@ DU_USER_DEFINED
@ DU_SUMO_INTERNAL
@ DU_TL_CONTROL
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
Base of value-generating classes (detectors)
virtual void clearState(SUMOTime)
Remove all vehicles before quick-loading state.
bool isTyped() const
Checks whether the detector is type specific.
MSDetectorFileOutput(const MSDetectorFileOutput &)
Invalidated copy constructor.
bool vehicleApplies(const SUMOTrafficObject &veh) const
Checks whether the detector measures vehicles of the given type.
std::vector< const MSEdge * > myNextEdges
The upcoming edges to filter by (empty means no filtering)
const int myDetectPersons
Whether pedestrians shall be detected instead of vehicles.
MSDetectorFileOutput & operator=(const MSDetectorFileOutput &)
Invalidated assignment operator.
virtual void reset()
Resets collected values.
virtual void detectorUpdate(const SUMOTime step)
Updates the detector (computes values)
virtual void writeXMLDetectorProlog(OutputDevice &dev) const =0
Open the XML-output.
const std::set< std::string > & getVehicleTypes() const
virtual ~MSDetectorFileOutput()
(virtual) destructor
bool personApplies(const MSTransportable &p, int dir) const
std::set< std::string > myVehicleTypes
The vehicle types to look for (empty means all)
virtual void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)=0
Write the generated output to the given device.
virtual GUIDetectorWrapper * buildDetectorGUIRepresentation()
Builds the graphical representation.
A road/street connecting two junctions.
Definition MSEdge.h:77
Base class for objects which have an id.
Definition Named.h:54
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
Representation of a vehicle, person, or container.