Eclipse SUMO - Simulation of Urban MObility
Lane.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2012-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 /****************************************************************************/
21 // C++ TraCI client API implementation
22 /****************************************************************************/
23 #pragma once
24 #include <vector>
25 #include <libsumo/TraCIDefs.h>
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 #ifndef LIBTRACI
32 class MSLane;
33 class PositionVector;
34 #endif
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
44 namespace LIBSUMO_NAMESPACE {
45 class Lane {
46 public:
47  // Getter
48  static int getLinkNumber(const std::string& laneID);
49  static std::string getEdgeID(const std::string& laneID);
50  static double getLength(const std::string& laneID);
51  static double getMaxSpeed(const std::string& laneID);
52  static double getFriction(const std::string& laneID);
53  static std::vector<std::string> getAllowed(const std::string& laneID);
54  static std::vector<std::string> getDisallowed(const std::string& laneID);
55  static std::vector<std::string> getChangePermissions(const std::string& laneID, const int direction);
56  static std::vector<libsumo::TraCIConnection> getLinks(const std::string& laneID);
57  static libsumo::TraCIPositionVector getShape(const std::string& laneID);
58  static double getWidth(const std::string& laneID);
59  static double getCO2Emission(const std::string& laneID);
60  static double getCOEmission(const std::string& laneID);
61  static double getHCEmission(const std::string& laneID);
62  static double getPMxEmission(const std::string& laneID);
63  static double getNOxEmission(const std::string& laneID);
64  static double getFuelConsumption(const std::string& laneID);
65  static double getNoiseEmission(const std::string& laneID);
66  static double getElectricityConsumption(const std::string& laneID);
67  static double getLastStepMeanSpeed(const std::string& laneID);
68  static double getLastStepOccupancy(const std::string& laneID);
69  static double getLastStepLength(const std::string& laneID);
70  static double getWaitingTime(const std::string& laneID);
71  static double getTraveltime(const std::string& laneID);
72  static int getLastStepVehicleNumber(const std::string& laneID);
73  static int getLastStepHaltingNumber(const std::string& laneID);
74  static std::vector<std::string> getLastStepVehicleIDs(const std::string& laneID);
75  static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
76  static std::vector<std::string> getInternalFoes(const std::string& laneID);
77  static const std::vector<std::string> getPendingVehicles(const std::string& laneID);
78  static double getAngle(const std::string& laneID, double relativePosition = libsumo::INVALID_DOUBLE_VALUE);
79  static std::string getBidiLane(const std::string& laneID);
80 
83 
84  // Setter
85  static void setAllowed(const std::string& laneID, std::string allowedClasses);
86  static void setAllowed(const std::string& laneID, std::vector<std::string> allowedClasses);
87  static void setDisallowed(const std::string& laneID, std::string disallowedClasses);
88  static void setDisallowed(const std::string& laneID, std::vector<std::string> disallowedClasses);
89  static void setChangePermissions(const std::string& laneID, std::vector<std::string> allowedClasses, const int direction);
90  static void setMaxSpeed(const std::string& laneID, double speed);
91  static void setLength(const std::string& laneID, double length);
92  static void setFriction(const std::string& laneID, double friction);
93 
94  // Generic parameter get/set
95  //static std::string getParameter(const std::string& laneID, const std::string& param);
96  //static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far
97 
98 #ifndef LIBTRACI
99 #ifndef SWIG
104  static void storeShape(const std::string& id, PositionVector& shape);
105 
106  static std::shared_ptr<VariableWrapper> makeWrapper();
107 
108  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
109 
110 private:
111  static MSLane* getLane(const std::string& id);
112 
113 private:
116 #endif
117 #endif
118 private:
120  Lane() = delete;
121 };
122 
123 
124 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
static libsumo::TraCIPositionVector getShape(const std::string &laneID)
static int getLinkNumber(const std::string &laneID)
static int getLastStepVehicleNumber(const std::string &laneID)
static double getCOEmission(const std::string &laneID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowed(const std::string &laneID, std::string allowedClasses)
static std::vector< std::string > getChangePermissions(const std::string &laneID, const int direction)
static double getWaitingTime(const std::string &laneID)
static double getFuelConsumption(const std::string &laneID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:115
static double getLastStepOccupancy(const std::string &laneID)
static double getNoiseEmission(const std::string &laneID)
static double getElectricityConsumption(const std::string &laneID)
static std::vector< std::string > getInternalFoes(const std::string &laneID)
static std::string getBidiLane(const std::string &laneID)
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:114
static double getHCEmission(const std::string &laneID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static void setLength(const std::string &laneID, double length)
static double getCO2Emission(const std::string &laneID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static void setDisallowed(const std::string &laneID, std::string disallowedClasses)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getMaxSpeed(const std::string &laneID)
static void setFriction(const std::string &laneID, double friction)
static double getPMxEmission(const std::string &laneID)
static const std::vector< std::string > getPendingVehicles(const std::string &laneID)
static double getLastStepLength(const std::string &laneID)
static int getLastStepHaltingNumber(const std::string &laneID)
static MSLane * getLane(const std::string &id)
static std::vector< libsumo::TraCIConnection > getLinks(const std::string &laneID)
static double getLength(const std::string &laneID)
static double getAngle(const std::string &laneID, double relativePosition=libsumo::INVALID_DOUBLE_VALUE)
static double getTraveltime(const std::string &laneID)
static double getWidth(const std::string &laneID)
static void setChangePermissions(const std::string &laneID, std::vector< std::string > allowedClasses, const int direction)
static double getNOxEmission(const std::string &laneID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &laneID)
Lane()=delete
invalidated standard constructor
static std::vector< std::string > getAllowed(const std::string &laneID)
static double getLastStepMeanSpeed(const std::string &laneID)
static void setMaxSpeed(const std::string &laneID, double speed)
static std::string getEdgeID(const std::string &laneID)
static std::vector< std::string > getDisallowed(const std::string &laneID)
static double getFriction(const std::string &laneID)
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
A list of positions.
TRACI_CONST double INVALID_DOUBLE_VALUE
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
A list of positions.
Definition: TraCIDefs.h:234