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-2022 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>
26 #include <libsumo/TraCIConstants.h>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 #ifndef LIBTRACI
33 class MSEdge;
34 class PositionVector;
35 #endif
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
45 namespace LIBSUMO_NAMESPACE {
46 class Edge {
47 public:
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 getLastStepOccupancy(const std::string& edgeID);
65  static int getLastStepHaltingNumber(const std::string& edgeID);
66  static double getLastStepLength(const std::string& edgeID);
67  static int getLaneNumber(const std::string& edgeID);
68  static std::string getStreetName(const std::string& edgeID);
69  static const std::vector<std::string> getPendingVehicles(const std::string& edgeID);
70 
73 
74  static void setAllowedVehicleClasses(const std::string& edgeID, std::vector<std::string> vector);
75  static void setDisallowedVehicleClasses(const std::string& edgeID, std::vector<std::string> classes);
76  static void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
77  static void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
78  static void setMaxSpeed(const std::string& edgeID, double speed);
79 
80 #ifndef LIBTRACI
81 #ifndef SWIG
86  static void storeShape(const std::string& edgeID, 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 void setAllowedSVCPermissions(const std::string& edgeID, int permissions);
94 
95  static MSEdge* getEdge(const std::string& edgeID);
96 
97 private:
100 #endif
101 #endif
102 private:
104  Edge() = delete;
105 
106 };
107 
108 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:108
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:56
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 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 double getNOxEmission(const std::string &edgeID)
Edge()=delete
invalidated standard constructor
static void setAllowedSVCPermissions(const std::string &edgeID, int permissions)
static void setDisallowedVehicleClasses(const std::string &edgeID, std::vector< std::string > classes)
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:99
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)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowedVehicleClasses(const std::string &edgeID, std::vector< std::string > vector)
static double getAdaptedTraveltime(const std::string &edgeID, double time)
static double getLastStepMeanSpeed(const std::string &edgeID)
static SubscriptionResults mySubscriptionResults
Definition: Edge.h:98
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:279
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:278