Eclipse SUMO - Simulation of Urban MObility
Edge.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2017-2023 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
74
75 static void setAllowed(const std::string& edgeID, std::string allowedClasses);
76 static void setAllowed(const std::string& edgeID, std::vector<std::string> allowedClasses);
77 static void setDisallowed(const std::string& edgeID, std::string disallowedClasses);
78 static void setDisallowed(const std::string& edgeID, std::vector<std::string> disallowedClasses);
79 static void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
80 static void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
81 static void setMaxSpeed(const std::string& edgeID, double speed);
82 static void setFriction(const std::string& edgeID, double value);
83
84#ifndef LIBTRACI
85#ifndef SWIG
90 static void storeShape(const std::string& edgeID, PositionVector& shape);
91
92 static std::shared_ptr<VariableWrapper> makeWrapper();
93
94 static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
95
96private:
97 static void setAllowedSVCPermissions(const std::string& edgeID, int permissions);
98
99 static MSEdge* getEdge(const std::string& edgeID);
100
101private:
104#endif
105#endif
106private:
108 Edge() = delete;
109
110};
111
112}
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
static void setFriction(const std::string &edgeID, double value)
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 void setAllowedSVCPermissions(const std::string &edgeID, int permissions)
static double getFuelConsumption(const std::string &edgeID)
static int getLastStepHaltingNumber(const std::string &edgeID)
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:103
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 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 std::string getStreetName(const std::string &edgeID)
static void setMaxSpeed(const std::string &edgeID, double speed)
static int getLastStepVehicleNumber(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:102
static double getNoiseEmission(const std::string &edgeID)
A road/street connecting two junctions.
Definition: MSEdge.h:77
A list of positions.
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:338
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:337