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.org/sumo
3 // Copyright (C) 2012-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 /****************************************************************************/
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 // class definitions
38 // ===========================================================================
43 namespace LIBSUMO_NAMESPACE {
44 class Lane {
45 public:
46  // Getter
47  static int getLinkNumber(std::string laneID);
48  static std::string getEdgeID(std::string laneID);
49  static double getLength(std::string laneID);
50  static double getMaxSpeed(std::string laneID);
51  static std::vector<std::string> getAllowed(std::string laneID);
52  static std::vector<std::string> getDisallowed(std::string laneID);
53  static std::vector<libsumo::TraCIConnection> getLinks(std::string laneID);
54  static libsumo::TraCIPositionVector getShape(std::string laneID);
55  static double getWidth(std::string laneID);
56  static double getCO2Emission(std::string laneID);
57  static double getCOEmission(std::string laneID);
58  static double getHCEmission(std::string laneID);
59  static double getPMxEmission(std::string laneID);
60  static double getNOxEmission(std::string laneID);
61  static double getFuelConsumption(std::string laneID);
62  static double getNoiseEmission(std::string laneID);
63  static double getElectricityConsumption(std::string laneID);
64  static double getLastStepMeanSpeed(std::string laneID);
65  static double getLastStepOccupancy(std::string laneID);
66  static double getLastStepLength(std::string laneID);
67  static double getWaitingTime(std::string laneID);
68  static double getTraveltime(std::string laneID);
69  static int getLastStepVehicleNumber(std::string laneID);
70  static int getLastStepHaltingNumber(std::string laneID);
71  static std::vector<std::string> getLastStepVehicleIDs(std::string laneID);
72  static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
73  static std::vector<std::string> getInternalFoes(const std::string& laneID);
74  static const std::vector<std::string> getPendingVehicles(const std::string& laneID);
75 
78 
79  // Setter
80  static void setAllowed(std::string laneID, std::string allowedClass);
81  static void setAllowed(std::string laneID, std::vector<std::string> allowedClasses);
82  static void setDisallowed(std::string laneID, std::vector<std::string> disallowedClasses);
83  static void setMaxSpeed(std::string laneID, double speed);
84  static void setLength(std::string laneID, double length);
85 
86 #ifndef LIBTRACI
87 #ifndef SWIG
92  static void storeShape(const std::string& id, PositionVector& shape);
93 
94  static std::shared_ptr<VariableWrapper> makeWrapper();
95 
96  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
97 
98 private:
99  static const MSLane* getLane(const std::string& id);
100 
101 private:
104 #endif
105 #endif
106 private:
108  Lane() = delete;
109 };
110 
111 
112 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:108
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:56
static void setMaxSpeed(std::string laneID, double speed)
static double getWaitingTime(std::string laneID)
static double getLastStepLength(std::string laneID)
static int getLastStepVehicleNumber(std::string laneID)
static double getPMxEmission(std::string laneID)
static double getLastStepOccupancy(std::string laneID)
static double getMaxSpeed(std::string laneID)
static std::vector< std::string > getAllowed(std::string laneID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:103
static double getCOEmission(std::string laneID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowed(std::string laneID, std::string allowedClass)
static double getNoiseEmission(std::string laneID)
static double getElectricityConsumption(std::string laneID)
static double getNOxEmission(std::string laneID)
static std::vector< std::string > getInternalFoes(const std::string &laneID)
static double getTraveltime(std::string laneID)
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
static std::string getEdgeID(std::string laneID)
static int getLinkNumber(std::string laneID)
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:102
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static double getLength(std::string laneID)
static void setLength(std::string laneID, double length)
static std::shared_ptr< VariableWrapper > makeWrapper()
static libsumo::TraCIPositionVector getShape(std::string laneID)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static const std::vector< std::string > getPendingVehicles(const std::string &laneID)
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
static const MSLane * getLane(const std::string &id)
static double getWidth(std::string laneID)
static int getLastStepHaltingNumber(std::string laneID)
static double getCO2Emission(std::string laneID)
static double getLastStepMeanSpeed(std::string laneID)
static std::vector< std::string > getDisallowed(std::string laneID)
Lane()=delete
invalidated standard constructor
static double getFuelConsumption(std::string laneID)
static double getHCEmission(std::string laneID)
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
static std::vector< libsumo::TraCIConnection > getLinks(std::string laneID)
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
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
A list of positions.
Definition: TraCIDefs.h:207