Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
Edge.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2017-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/****************************************************************************/
18// C++ TraCI client API implementation
19/****************************************************************************/
20
21#pragma once
22#include <string>
23#include <vector>
24#include <memory>
25#include <libsumo/TraCIDefs.h>
27
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
32#ifndef LIBTRACI
33class MSEdge;
34class PositionVector;
35#endif
36
37
38// ===========================================================================
39// class definitions
40// ===========================================================================
45namespace LIBSUMO_NAMESPACE {
46class Edge {
47public:
48 static double getAdaptedTraveltime(const std::string& edgeID, double time);
49 static double getEffort(const std::string& edgeID, double time);
50 static double getTraveltime(const std::string& edgeID);
51 static double getWaitingTime(const std::string& edgeID);
52 static const std::vector<std::string> getLastStepPersonIDs(const std::string& edgeID);
53 static const std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID);
54 static double getCO2Emission(const std::string& edgeID);
55 static double getCOEmission(const std::string& edgeID);
56 static double getHCEmission(const std::string& edgeID);
57 static double getPMxEmission(const std::string& edgeID);
58 static double getNOxEmission(const std::string& edgeID);
59 static double getFuelConsumption(const std::string& edgeID);
60 static double getNoiseEmission(const std::string& edgeID);
61 static double getElectricityConsumption(const std::string& edgeID);
62 static int getLastStepVehicleNumber(const std::string& edgeID);
63 static double getLastStepMeanSpeed(const std::string& edgeID);
64 static double getMeanFriction(const std::string& edgeID);
65 static double getLastStepOccupancy(const std::string& edgeID);
66 static int getLastStepHaltingNumber(const std::string& edgeID);
67 static double getLastStepLength(const std::string& edgeID);
68 static int getLaneNumber(const std::string& edgeID);
69 static std::string getStreetName(const std::string& edgeID);
70 static const std::vector<std::string> getPendingVehicles(const std::string& edgeID);
71 static double getAngle(const std::string& edgeID, double relativePosition = libsumo::INVALID_DOUBLE_VALUE);
72 static std::string getFromJunction(const std::string& edgeID);
73 static std::string getToJunction(const std::string& edgeID);
74 static std::string getBidiEdge(const std::string& edgeID);
75
78
79 static void setAllowed(const std::string& edgeID, std::string allowedClasses);
80 static void setAllowed(const std::string& edgeID, std::vector<std::string> allowedClasses);
81 static void setDisallowed(const std::string& edgeID, std::string disallowedClasses);
82 static void setDisallowed(const std::string& edgeID, std::vector<std::string> disallowedClasses);
83 static void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
84 static void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
85 static void setMaxSpeed(const std::string& edgeID, double speed);
86 static void setFriction(const std::string& edgeID, double friction);
87
88#ifndef LIBTRACI
89#ifndef SWIG
94 static void storeShape(const std::string& edgeID, PositionVector& shape);
95
96 static std::shared_ptr<VariableWrapper> makeWrapper();
97
98 static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
99
100private:
101 static void setAllowedSVCPermissions(const std::string& edgeID, long long int permissions);
102
103 static MSEdge* getEdge(const std::string& edgeID);
104
105private:
106 static SubscriptionResults mySubscriptionResults;
107 static ContextSubscriptionResults myContextSubscriptionResults;
108#endif
109#endif
110private:
112 Edge() = delete;
113
114};
115
116}
#define LIBSUMO_ID_PARAMETER_API
Definition TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition TraCIDefs.h:62
static double getCO2Emission(const std::string &edgeID)
static void storeShape(const std::string &edgeID, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getLastStepLength(const std::string &edgeID)
static double getMeanFriction(const std::string &edgeID)
static double getCOEmission(const std::string &edgeID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static const std::vector< std::string > getLastStepPersonIDs(const std::string &edgeID)
static void adaptTraveltime(const std::string &edgeID, double time, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max())
static void setDisallowed(const std::string &edgeID, std::string disallowedClasses)
static double getNOxEmission(const std::string &edgeID)
Edge()=delete
invalidated standard constructor
static double getFuelConsumption(const std::string &edgeID)
static int getLastStepHaltingNumber(const std::string &edgeID)
static void setFriction(const std::string &edgeID, double friction)
static void setEffort(const std::string &edgeID, double effort, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max())
static const std::vector< std::string > getPendingVehicles(const std::string &edgeID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition Edge.h:107
static double getPMxEmission(const std::string &edgeID)
static double getTraveltime(const std::string &edgeID)
static double getWaitingTime(const std::string &edgeID)
static const std::vector< std::string > getLastStepVehicleIDs(const std::string &edgeID)
static int getLaneNumber(const std::string &edgeID)
static double getHCEmission(const std::string &edgeID)
static std::string getFromJunction(const std::string &edgeID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static MSEdge * getEdge(const std::string &edgeID)
static double getEffort(const std::string &edgeID, double time)
static double getLastStepOccupancy(const std::string &edgeID)
static void setAllowedSVCPermissions(const std::string &edgeID, long long int permissions)
static std::string getStreetName(const std::string &edgeID)
static std::string getBidiEdge(const std::string &edgeID)
static void setMaxSpeed(const std::string &edgeID, double speed)
static int getLastStepVehicleNumber(const std::string &edgeID)
static std::string getToJunction(const std::string &edgeID)
static double getElectricityConsumption(const std::string &edgeID)
static double getAdaptedTraveltime(const std::string &edgeID, double time)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowed(const std::string &edgeID, std::string allowedClasses)
static double getLastStepMeanSpeed(const std::string &edgeID)
static SubscriptionResults mySubscriptionResults
Definition Edge.h:106
static double getAngle(const std::string &edgeID, double relativePosition=libsumo::INVALID_DOUBLE_VALUE)
static double getNoiseEmission(const std::string &edgeID)
A road/street connecting two junctions.
Definition MSEdge.h:77
A list of positions.
TRACI_CONST double INVALID_DOUBLE_VALUE