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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // C++ TraCI client API implementation
18 /****************************************************************************/
19 #ifndef Lane_h
20 #define Lane_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <libsumo/TraCIDefs.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MSLane;
36 class PositionVector;
37 namespace libsumo {
38 class VariableWrapper;
39 }
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
49 namespace libsumo {
50 class Lane {
51 public:
52  // Getter
53  static std::vector<std::string> getIDList();
54  static int getIDCount();
55  static int getLinkNumber(std::string laneID);
56  static std::string getEdgeID(std::string laneID);
57  static double getLength(std::string laneID);
58  static double getMaxSpeed(std::string laneID);
59  static std::vector<std::string> getAllowed(std::string laneID);
60  static std::vector<std::string> getDisallowed(std::string laneID);
61  static std::vector<TraCIConnection> getLinks(std::string laneID);
62  static TraCIPositionVector getShape(std::string laneID);
63  static double getWidth(std::string laneID);
64  static double getCO2Emission(std::string laneID);
65  static double getCOEmission(std::string laneID);
66  static double getHCEmission(std::string laneID);
67  static double getPMxEmission(std::string laneID);
68  static double getNOxEmission(std::string laneID);
69  static double getFuelConsumption(std::string laneID);
70  static double getNoiseEmission(std::string laneID);
71  static double getElectricityConsumption(std::string laneID);
72  static double getLastStepMeanSpeed(std::string laneID);
73  static double getLastStepOccupancy(std::string laneID);
74  static double getLastStepLength(std::string laneID);
75  static double getWaitingTime(std::string laneID);
76  static double getTraveltime(std::string laneID);
77  static int getLastStepVehicleNumber(std::string laneID);
78  static int getLastStepHaltingNumber(std::string laneID);
79  static std::vector<std::string> getLastStepVehicleIDs(std::string laneID);
80  static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
81  static std::vector<std::string> getInternalFoes(const std::string& laneID);
82 
83  // Setter
84  static void setAllowed(std::string laneID, std::vector<std::string> allowedClasses);
85  static void setDisallowed(std::string laneID, std::vector<std::string> disallowedClasses);
86  static void setMaxSpeed(std::string laneID, double speed);
87  static void setLength(std::string laneID, double length);
88 
89  // Generic parameter get/set
90  static std::string getParameter(const std::string& laneID, const std::string& param);
91  static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far
92 
94 
99  static void storeShape(const std::string& id, PositionVector& shape);
100 
101  static std::shared_ptr<VariableWrapper> makeWrapper();
102 
103  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
104 
105 private:
106  static const MSLane* getLane(const std::string& id);
107 
108 private:
111 
113  Lane() = delete;
114 };
115 
116 
117 }
118 
119 
120 #endif
121 
122 /****************************************************************************/
libsumo::Lane::getInternalFoes
static std::vector< std::string > getInternalFoes(const std::string &laneID)
Definition: Lane.cpp:287
libsumo::Lane::setMaxSpeed
static void setMaxSpeed(std::string laneID, double speed)
Definition: Lane.cpp:328
TraCIPositionVector
A list of positions.
LIBSUMO_SUBSCRIPTION_API
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:41
libsumo::Lane::getLastStepHaltingNumber
static int getLastStepHaltingNumber(std::string laneID)
Definition: Lane.cpp:243
libsumo::Lane::getCOEmission
static double getCOEmission(std::string laneID)
Definition: Lane.cpp:151
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
libsumo::Lane::getTraveltime
static double getTraveltime(std::string laneID)
Definition: Lane.cpp:226
libsumo::VariableWrapper
Definition: Subscription.h:132
libsumo::Lane::getCO2Emission
static double getCO2Emission(std::string laneID)
Definition: Lane.cpp:145
libsumo::Lane::getLastStepMeanSpeed
static double getLastStepMeanSpeed(std::string laneID)
Definition: Lane.cpp:192
libsumo::Lane::getLastStepLength
static double getLastStepLength(std::string laneID)
Definition: Lane.cpp:204
libsumo::Lane::storeShape
static LIBSUMO_SUBSCRIPTION_API void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: Lane.cpp:368
libsumo::Lane::getFoes
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
Definition: Lane.cpp:271
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:204
libsumo::Lane::setParameter
static void setParameter(const std::string &routeID, const std::string &key, const std::string &value)
Definition: Lane.cpp:348
libsumo::Lane::setLength
static void setLength(std::string laneID, double length)
Definition: Lane.cpp:335
PositionVector
A list of positions.
Definition: PositionVector.h:45
libsumo::Lane::setAllowed
static void setAllowed(std::string laneID, std::vector< std::string > allowedClasses)
Definition: Lane.cpp:306
libsumo::Lane::getShape
static TraCIPositionVector getShape(std::string laneID)
Definition: Lane.cpp:124
libsumo
Definition: Edge.cpp:29
libsumo::Lane::getLastStepVehicleIDs
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
Definition: Lane.cpp:258
libsumo::Lane::getIDCount
static int getIDCount()
Definition: Lane.cpp:56
libsumo::Lane::getParameter
static std::string getParameter(const std::string &laneID, const std::string &param)
Definition: Lane.cpp:342
libsumo::Lane::getElectricityConsumption
static double getElectricityConsumption(std::string laneID)
Definition: Lane.cpp:186
libsumo::Lane::getNOxEmission
static double getNOxEmission(std::string laneID)
Definition: Lane.cpp:169
libsumo::Lane::getFuelConsumption
static double getFuelConsumption(std::string laneID)
Definition: Lane.cpp:174
libsumo::Lane::getLastStepVehicleNumber
static int getLastStepVehicleNumber(std::string laneID)
Definition: Lane.cpp:238
libsumo::Lane::getMaxSpeed
static double getMaxSpeed(std::string laneID)
Definition: Lane.cpp:74
libsumo::Lane::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Lane.cpp:374
libsumo::Lane::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:110
libsumo::Lane::getEdgeID
static std::string getEdgeID(std::string laneID)
Definition: Lane.cpp:62
libsumo::Lane::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:109
libsumo::Lane::getWaitingTime
static double getWaitingTime(std::string laneID)
Definition: Lane.cpp:220
libsumo::Lane::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Lane.cpp:380
libsumo::Lane::getLinks
static std::vector< TraCIConnection > getLinks(std::string laneID)
Definition: Lane.cpp:86
libsumo::Lane::getLinkNumber
static int getLinkNumber(std::string laneID)
Definition: Lane.cpp:80
libsumo::Lane::getAllowed
static std::vector< std::string > getAllowed(std::string laneID)
Definition: Lane.cpp:108
libsumo::Lane::getLength
static double getLength(std::string laneID)
Definition: Lane.cpp:68
libsumo::Lane::getNoiseEmission
static double getNoiseEmission(std::string laneID)
Definition: Lane.cpp:180
libsumo::Lane::Lane
Lane()=delete
invalidated standard constructor
libsumo::Lane::getHCEmission
static double getHCEmission(std::string laneID)
Definition: Lane.cpp:157
libsumo::Lane::getDisallowed
static std::vector< std::string > getDisallowed(std::string laneID)
Definition: Lane.cpp:118
libsumo::Lane::getWidth
static double getWidth(std::string laneID)
Definition: Lane.cpp:139
libsumo::Lane::getIDList
static std::vector< std::string > getIDList()
Definition: Lane.cpp:48
libsumo::Lane::getLane
static const MSLane * getLane(const std::string &id)
Definition: Lane.cpp:358
config.h
libsumo::Lane
Definition: Lane.h:50
libsumo::Lane::getLastStepOccupancy
static double getLastStepOccupancy(std::string laneID)
Definition: Lane.cpp:198
libsumo::Lane::getPMxEmission
static double getPMxEmission(std::string laneID)
Definition: Lane.cpp:163
TraCIDefs.h
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:203
libsumo::Lane::setDisallowed
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
Definition: Lane.cpp:317