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-2020 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 <config.h>
23 
24 #include <string>
25 #include <vector>
26 #include <memory>
27 #include <libsumo/TraCIDefs.h>
28 #include <libsumo/TraCIConstants.h>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 #ifndef LIBTRACI
35 class MSEdge;
36 class PositionVector;
37 namespace libsumo {
38 class VariableWrapper;
39 }
40 #endif
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 namespace LIBSUMO_NAMESPACE {
51 class Edge {
52 public:
53  static double getAdaptedTraveltime(const std::string& edgeID, double time);
54  static double getEffort(const std::string& edgeID, double time);
55  static double getTraveltime(const std::string& edgeID);
56  static double getWaitingTime(const std::string& edgeID);
57  static const std::vector<std::string> getLastStepPersonIDs(const std::string& edgeID);
58  static const std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID);
59  static double getCO2Emission(const std::string& edgeID);
60  static double getCOEmission(const std::string& edgeID);
61  static double getHCEmission(const std::string& edgeID);
62  static double getPMxEmission(const std::string& edgeID);
63  static double getNOxEmission(const std::string& edgeID);
64  static double getFuelConsumption(const std::string& edgeID);
65  static double getNoiseEmission(const std::string& edgeID);
66  static double getElectricityConsumption(const std::string& edgeID);
67  static int getLastStepVehicleNumber(const std::string& edgeID);
68  static double getLastStepMeanSpeed(const std::string& edgeID);
69  static double getLastStepOccupancy(const std::string& edgeID);
70  static int getLastStepHaltingNumber(const std::string& edgeID);
71  static double getLastStepLength(const std::string& edgeID);
72  static int getLaneNumber(const std::string& edgeID);
73  static std::string getStreetName(const std::string& edgeID);
74 
77 
78  static void setAllowedVehicleClasses(const std::string& edgeID, std::vector<std::string> vector);
79  static void setDisallowedVehicleClasses(const std::string& edgeID, std::vector<std::string> classes);
80  static void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
81  static void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
82  static void setMaxSpeed(const std::string& edgeID, double speed);
83 
84 #ifndef LIBTRACI
85  // TODO check who needs this function, it is not in the python client
86  static void setAllowedSVCPermissions(const std::string& edgeID, int permissions);
87 
92  static void storeShape(const std::string& edgeID, PositionVector& shape);
93 
94  static std::shared_ptr<VariableWrapper> makeWrapper();
95 
96  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
97 
98 private:
99  static MSEdge* getEdge(const std::string& edgeID);
100 
101 private:
104 #endif
105 private:
107  Edge() = delete;
108 
109 };
110 
111 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:97
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
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 bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static void setEffort(const std::string &edgeID, double effort, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max())
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 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: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, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:250
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:251