Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/libsumo/LaneArea.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2017-2025 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 LaneArea.h
15
/// @author Michael Behrisch
16
/// @date 15.03.2017
17
///
18
// C++ TraCI client API implementation
19
/****************************************************************************/
20
#pragma once
21
#include <string>
22
#include <vector>
23
#include <libsumo/TraCIDefs.h>
24
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
#ifndef LIBTRACI
30
class MSE2Collector;
31
class NamedRTree;
32
class PositionVector;
33
#endif
34
35
36
// ===========================================================================
37
// class definitions
38
// ===========================================================================
39
/**
40
* @class LaneArea
41
* @brief C++ TraCI client API implementation
42
*/
43
namespace LIBSUMO_NAMESPACE {
44
class LaneArea {
45
public:
46
static int getJamLengthVehicle(const std::string& detID);
47
static double getJamLengthMeters(const std::string& detID);
48
static double getLastStepMeanSpeed(const std::string& detID);
49
static std::vector<std::string> getLastStepVehicleIDs(const std::string& detID);
50
static double getLastStepOccupancy(const std::string& detID);
51
static double getPosition(const std::string& detID);
52
static std::string getLaneID(const std::string& detID);
53
static double getLength(const std::string& detID);
54
static int getLastStepVehicleNumber(const std::string& detID);
55
static int getLastStepHaltingNumber(const std::string& detID);
56
57
static double getIntervalOccupancy(const std::string& detID);
58
static double getIntervalMeanSpeed(const std::string& detID);
59
static double getIntervalMeanTimeLoss(const std::string& detID);
60
static double getIntervalMaxJamLengthInMeters(const std::string& detID);
61
static int getIntervalVehicleNumber(const std::string& detID);
62
63
static double getLastIntervalOccupancy(const std::string& detID);
64
static double getLastIntervalMeanSpeed(const std::string& detID);
65
static double getLastIntervalMeanTimeLoss(const std::string& detID);
66
static double getLastIntervalMaxJamLengthInMeters(const std::string& detID);
67
static int getLastIntervalVehicleNumber(const std::string& detID);
68
69
static void overrideVehicleNumber(const std::string& detID, int vehNum);
70
71
LIBSUMO_ID_PARAMETER_API
72
LIBSUMO_SUBSCRIPTION_API
73
74
#ifndef LIBTRACI
75
#ifndef SWIG
76
/** @brief Returns a tree filled with inductive loop instances
77
* @return The rtree of inductive loops
78
*/
79
static NamedRTree* getTree();
80
static void cleanup();
81
82
/** @brief Saves the shape of the requested object in the given container
83
* @param id The id of the loop to retrieve
84
* @param shape The container to fill
85
*/
86
static void storeShape(const std::string& id, PositionVector& shape);
87
88
static std::shared_ptr<VariableWrapper> makeWrapper();
89
90
static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
91
92
private:
93
static MSE2Collector* getDetector(const std::string& detID);
94
95
private:
96
private:
97
static NamedRTree* myTree;
98
static SubscriptionResults mySubscriptionResults;
99
static ContextSubscriptionResults myContextSubscriptionResults;
100
#endif
101
#endif
102
103
private:
104
/// @brief invalidated standard constructor
105
LaneArea() = delete;
106
107
};
108
}
109
110