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-2018 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 /****************************************************************************/
static double getCO2Emission(std::string laneID)
Definition: Lane.cpp:146
static double getLength(std::string laneID)
Definition: Lane.cpp:69
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:199
static double getNOxEmission(std::string laneID)
Definition: Lane.cpp:170
static void setAllowed(std::string laneID, std::vector< std::string > allowedClasses)
Definition: Lane.cpp:307
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
Definition: Lane.cpp:272
static std::vector< TraCIConnection > getLinks(std::string laneID)
Definition: Lane.cpp:87
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
static std::string getEdgeID(std::string laneID)
Definition: Lane.cpp:63
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
static void setParameter(const std::string &routeID, const std::string &key, const std::string &value)
Definition: Lane.cpp:349
static std::vector< std::string > getAllowed(std::string laneID)
Definition: Lane.cpp:109
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Lane.cpp:375
static std::vector< std::string > getInternalFoes(const std::string &laneID)
Definition: Lane.cpp:288
static double getElectricityConsumption(std::string laneID)
Definition: Lane.cpp:187
static double getFuelConsumption(std::string laneID)
Definition: Lane.cpp:175
static int getIDCount()
Definition: Lane.cpp:57
static int getLastStepHaltingNumber(std::string laneID)
Definition: Lane.cpp:244
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:200
static double getWidth(std::string laneID)
Definition: Lane.cpp:140
static int getLastStepVehicleNumber(std::string laneID)
Definition: Lane.cpp:239
static double getMaxSpeed(std::string laneID)
Definition: Lane.cpp:75
static double getPMxEmission(std::string laneID)
Definition: Lane.cpp:164
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:111
static double getLastStepLength(std::string laneID)
Definition: Lane.cpp:205
static double getHCEmission(std::string laneID)
Definition: Lane.cpp:158
A list of positions.
static double getLastStepMeanSpeed(std::string laneID)
Definition: Lane.cpp:193
static TraCIPositionVector getShape(std::string laneID)
Definition: Lane.cpp:125
static void setMaxSpeed(std::string laneID, double speed)
Definition: Lane.cpp:329
Lane()=delete
invalidated standard constructor
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
Definition: Lane.cpp:318
static const MSLane * getLane(const std::string &id)
Definition: Lane.cpp:359
Definition: Edge.cpp:30
static std::string getParameter(const std::string &laneID, const std::string &param)
Definition: Lane.cpp:343
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:110
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
Definition: Lane.cpp:259
static double getWaitingTime(std::string laneID)
Definition: Lane.cpp:221
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Lane.cpp:381
static double getTraveltime(std::string laneID)
Definition: Lane.cpp:227
static void setLength(std::string laneID, double length)
Definition: Lane.cpp:336
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
A list of positions.
static double getNoiseEmission(std::string laneID)
Definition: Lane.cpp:181
static double getLastStepOccupancy(std::string laneID)
Definition: Lane.cpp:199
static std::vector< std::string > getDisallowed(std::string laneID)
Definition: Lane.cpp:119
static int getLinkNumber(std::string laneID)
Definition: Lane.cpp:81
static double getCOEmission(std::string laneID)
Definition: Lane.cpp:152
static std::vector< std::string > getIDList()
Definition: Lane.cpp:49