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-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 /****************************************************************************/
21 // C++ TraCI client API implementation
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <vector>
27 #include <libsumo/TraCIDefs.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 #ifndef LIBTRACI
34 class MSLane;
35 class PositionVector;
36 namespace libsumo {
37 class VariableWrapper;
38 }
39 #endif
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 namespace LIBSUMO_NAMESPACE {
49 class Lane {
50 public:
51  // Getter
52  static int getLinkNumber(std::string laneID);
53  static std::string getEdgeID(std::string laneID);
54  static double getLength(std::string laneID);
55  static double getMaxSpeed(std::string laneID);
56  static std::vector<std::string> getAllowed(std::string laneID);
57  static std::vector<std::string> getDisallowed(std::string laneID);
58  static std::vector<libsumo::TraCIConnection> getLinks(std::string laneID);
59  static libsumo::TraCIPositionVector getShape(std::string laneID);
60  static double getWidth(std::string laneID);
61  static double getCO2Emission(std::string laneID);
62  static double getCOEmission(std::string laneID);
63  static double getHCEmission(std::string laneID);
64  static double getPMxEmission(std::string laneID);
65  static double getNOxEmission(std::string laneID);
66  static double getFuelConsumption(std::string laneID);
67  static double getNoiseEmission(std::string laneID);
68  static double getElectricityConsumption(std::string laneID);
69  static double getLastStepMeanSpeed(std::string laneID);
70  static double getLastStepOccupancy(std::string laneID);
71  static double getLastStepLength(std::string laneID);
72  static double getWaitingTime(std::string laneID);
73  static double getTraveltime(std::string laneID);
74  static int getLastStepVehicleNumber(std::string laneID);
75  static int getLastStepHaltingNumber(std::string laneID);
76  static std::vector<std::string> getLastStepVehicleIDs(std::string laneID);
77  static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
78  static std::vector<std::string> getInternalFoes(const std::string& laneID);
79 
82 
83  // Setter
84  static void setAllowed(std::string laneID, std::string allowedClass);
85  static void setAllowed(std::string laneID, std::vector<std::string> allowedClasses);
86  static void setDisallowed(std::string laneID, std::vector<std::string> disallowedClasses);
87  static void setMaxSpeed(std::string laneID, double speed);
88  static void setLength(std::string laneID, double length);
89 
90 #ifndef LIBTRACI
95  static void storeShape(const std::string& id, PositionVector& shape);
96 
97  static std::shared_ptr<VariableWrapper> makeWrapper();
98 
99  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
100 
101 private:
102  static const MSLane* getLane(const std::string& id);
103 
104 private:
107 #endif
108 private:
110  Lane() = delete;
111 };
112 
113 
114 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:97
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
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:106
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 bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
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:105
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 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::vector< TraCIPosition > TraCIPositionVector
Definition: TraCIDefs.h:196
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:250
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:251