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 /****************************************************************************/
18 // C++ TraCI client API implementation
19 /****************************************************************************/
20 #ifndef Lane_h
21 #define Lane_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <libsumo/TraCIDefs.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class MSLane;
37 class PositionVector;
38 namespace libsumo {
39 class VariableWrapper;
40 }
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 namespace libsumo {
51 class Lane {
52 public:
53  // Getter
54  static std::vector<std::string> getIDList();
55  static int getIDCount();
56  static int getLinkNumber(std::string laneID);
57  static std::string getEdgeID(std::string laneID);
58  static double getLength(std::string laneID);
59  static double getMaxSpeed(std::string laneID);
60  static std::vector<std::string> getAllowed(std::string laneID);
61  static std::vector<std::string> getDisallowed(std::string laneID);
62  static std::vector<TraCIConnection> getLinks(std::string laneID);
63  static TraCIPositionVector getShape(std::string laneID);
64  static double getWidth(std::string laneID);
65  static double getCO2Emission(std::string laneID);
66  static double getCOEmission(std::string laneID);
67  static double getHCEmission(std::string laneID);
68  static double getPMxEmission(std::string laneID);
69  static double getNOxEmission(std::string laneID);
70  static double getFuelConsumption(std::string laneID);
71  static double getNoiseEmission(std::string laneID);
72  static double getElectricityConsumption(std::string laneID);
73  static double getLastStepMeanSpeed(std::string laneID);
74  static double getLastStepOccupancy(std::string laneID);
75  static double getLastStepLength(std::string laneID);
76  static double getWaitingTime(std::string laneID);
77  static double getTraveltime(std::string laneID);
78  static int getLastStepVehicleNumber(std::string laneID);
79  static int getLastStepHaltingNumber(std::string laneID);
80  static std::vector<std::string> getLastStepVehicleIDs(std::string laneID);
81  static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
82  static std::vector<std::string> getInternalFoes(const std::string& laneID);
83 
84  // Setter
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  // Generic parameter get/set
91  static std::string getParameter(const std::string& laneID, const std::string& param);
92  static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far
93 
95 
100  static void storeShape(const std::string& id, PositionVector& shape);
101 
102  static std::shared_ptr<VariableWrapper> makeWrapper();
103 
104  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
105 
106 private:
107  static const MSLane* getLane(const std::string& id);
108 
109 private:
112 
114  Lane() = delete;
115 };
116 
117 
118 }
119 
120 
121 #endif
122 
123 /****************************************************************************/
libsumo::Lane::getInternalFoes
static std::vector< std::string > getInternalFoes(const std::string &laneID)
Definition: Lane.cpp:288
libsumo::Lane::setMaxSpeed
static void setMaxSpeed(std::string laneID, double speed)
Definition: Lane.cpp:329
TraCIPositionVector
A list of positions.
LIBSUMO_SUBSCRIPTION_API
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:42
libsumo::Lane::getLastStepHaltingNumber
static int getLastStepHaltingNumber(std::string laneID)
Definition: Lane.cpp:244
libsumo::Lane::getCOEmission
static double getCOEmission(std::string laneID)
Definition: Lane.cpp:152
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
libsumo::Lane::getTraveltime
static double getTraveltime(std::string laneID)
Definition: Lane.cpp:227
libsumo::VariableWrapper
Definition: Subscription.h:114
libsumo::Lane::getCO2Emission
static double getCO2Emission(std::string laneID)
Definition: Lane.cpp:146
libsumo::Lane::getLastStepMeanSpeed
static double getLastStepMeanSpeed(std::string laneID)
Definition: Lane.cpp:193
libsumo::Lane::getLastStepLength
static double getLastStepLength(std::string laneID)
Definition: Lane.cpp:205
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:369
libsumo::Lane::getFoes
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
Definition: Lane.cpp:272
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:205
libsumo::Lane::setParameter
static void setParameter(const std::string &routeID, const std::string &key, const std::string &value)
Definition: Lane.cpp:349
libsumo::Lane::setLength
static void setLength(std::string laneID, double length)
Definition: Lane.cpp:336
PositionVector
A list of positions.
Definition: PositionVector.h:46
libsumo::Lane::setAllowed
static void setAllowed(std::string laneID, std::vector< std::string > allowedClasses)
Definition: Lane.cpp:307
libsumo::Lane::getShape
static TraCIPositionVector getShape(std::string laneID)
Definition: Lane.cpp:125
libsumo
Definition: Edge.cpp:30
libsumo::Lane::getLastStepVehicleIDs
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
Definition: Lane.cpp:259
libsumo::Lane::getIDCount
static int getIDCount()
Definition: Lane.cpp:57
libsumo::Lane::getParameter
static std::string getParameter(const std::string &laneID, const std::string &param)
Definition: Lane.cpp:343
libsumo::Lane::getElectricityConsumption
static double getElectricityConsumption(std::string laneID)
Definition: Lane.cpp:187
libsumo::Lane::getNOxEmission
static double getNOxEmission(std::string laneID)
Definition: Lane.cpp:170
libsumo::Lane::getFuelConsumption
static double getFuelConsumption(std::string laneID)
Definition: Lane.cpp:175
libsumo::Lane::getLastStepVehicleNumber
static int getLastStepVehicleNumber(std::string laneID)
Definition: Lane.cpp:239
libsumo::Lane::getMaxSpeed
static double getMaxSpeed(std::string laneID)
Definition: Lane.cpp:75
libsumo::Lane::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Lane.cpp:375
libsumo::Lane::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:111
libsumo::Lane::getEdgeID
static std::string getEdgeID(std::string laneID)
Definition: Lane.cpp:63
libsumo::Lane::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:110
libsumo::Lane::getWaitingTime
static double getWaitingTime(std::string laneID)
Definition: Lane.cpp:221
libsumo::Lane::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Lane.cpp:381
libsumo::Lane::getLinks
static std::vector< TraCIConnection > getLinks(std::string laneID)
Definition: Lane.cpp:87
libsumo::Lane::getLinkNumber
static int getLinkNumber(std::string laneID)
Definition: Lane.cpp:81
libsumo::Lane::getAllowed
static std::vector< std::string > getAllowed(std::string laneID)
Definition: Lane.cpp:109
libsumo::Lane::getLength
static double getLength(std::string laneID)
Definition: Lane.cpp:69
libsumo::Lane::getNoiseEmission
static double getNoiseEmission(std::string laneID)
Definition: Lane.cpp:181
libsumo::Lane::Lane
Lane()=delete
invalidated standard constructor
libsumo::Lane::getHCEmission
static double getHCEmission(std::string laneID)
Definition: Lane.cpp:158
libsumo::Lane::getDisallowed
static std::vector< std::string > getDisallowed(std::string laneID)
Definition: Lane.cpp:119
libsumo::Lane::getWidth
static double getWidth(std::string laneID)
Definition: Lane.cpp:140
libsumo::Lane::getIDList
static std::vector< std::string > getIDList()
Definition: Lane.cpp:49
libsumo::Lane::getLane
static const MSLane * getLane(const std::string &id)
Definition: Lane.cpp:359
config.h
libsumo::Lane
Definition: Lane.h:51
libsumo::Lane::getLastStepOccupancy
static double getLastStepOccupancy(std::string laneID)
Definition: Lane.cpp:199
libsumo::Lane::getPMxEmission
static double getPMxEmission(std::string laneID)
Definition: Lane.cpp:164
TraCIDefs.h
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:204
libsumo::Lane::setDisallowed
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
Definition: Lane.cpp:318