SUMO - Simulation of Urban MObility
TrafficLight.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 /****************************************************************************/
17 // C++ TraCI client API implementation
18 /****************************************************************************/
19 #ifndef TrafficLight_h
20 #define TrafficLight_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <libsumo/TraCIDefs.h>
31 #ifndef SWIGJAVA
32 #ifndef SWIGPYTHON
34 #endif
35 #endif
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 namespace libsumo {
42 class VariableWrapper;
43 }
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 namespace libsumo {
54 class TrafficLight {
55 public:
56 
57  static std::vector<std::string> getIDList();
58  static int getIDCount();
59  static std::string getRedYellowGreenState(const std::string& tlsID);
60  static std::vector<TraCILogic> getCompleteRedYellowGreenDefinition(const std::string& tlsID);
61  static std::vector<std::string> getControlledJunctions(const std::string& tlsID);
62  static std::vector<std::string> getControlledLanes(const std::string& tlsID);
63  static std::vector<std::vector<TraCILink> > getControlledLinks(const std::string& tlsID);
64  static std::string getProgram(const std::string& tlsID);
65  static int getPhase(const std::string& tlsID);
66  static double getPhaseDuration(const std::string& tlsID);
67  static double getNextSwitch(const std::string& tlsID);
68  static std::string getParameter(const std::string& tlsID, const std::string& paramName);
69 
70  static void setRedYellowGreenState(const std::string& tlsID, const std::string& state);
71  static void setPhase(const std::string& tlsID, const int index);
72  static void setProgram(const std::string& tlsID, const std::string& programID);
73  static void setPhaseDuration(const std::string& tlsID, const double phaseDuration);
74  static void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCILogic& logic);
75  static void setParameter(const std::string& tlsID, const std::string& paramName, const std::string& value);
76 
78 
79  static std::shared_ptr<VariableWrapper> makeWrapper();
80 
81  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
82 
83 private:
84 #ifndef SWIGJAVA
85 #ifndef SWIGPYTHON
86  static MSTLLogicControl::TLSLogicVariants& getTLS(const std::string& id);
87 #endif
88 #endif
89 
90 private:
93 
95  TrafficLight() = delete;
96 };
97 
98 
99 }
100 
101 
102 #endif
103 
104 /****************************************************************************/
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:199
static double getPhaseDuration(const std::string &tlsID)
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
Storage for all programs of a single tls.
static void setPhaseDuration(const std::string &tlsID, const double phaseDuration)
static std::string getRedYellowGreenState(const std::string &tlsID)
static std::vector< std::string > getControlledJunctions(const std::string &tlsID)
static void setParameter(const std::string &tlsID, const std::string &paramName, const std::string &value)
static std::vector< std::string > getIDList()
TrafficLight()=delete
invalidated standard constructor
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:200
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static std::vector< std::string > getControlledLanes(const std::string &tlsID)
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
static MSTLLogicControl::TLSLogicVariants & getTLS(const std::string &id)
static double getNextSwitch(const std::string &tlsID)
static int getIDCount()
static SubscriptionResults mySubscriptionResults
Definition: TrafficLight.h:91
static LIBSUMO_SUBSCRIPTION_API std::shared_ptr< VariableWrapper > makeWrapper()
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
Definition: Edge.cpp:30
static void setPhase(const std::string &tlsID, const int index)
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
static void setProgram(const std::string &tlsID, const std::string &programID)
static std::string getProgram(const std::string &tlsID)
static int getPhase(const std::string &tlsID)
static std::string getParameter(const std::string &tlsID, const std::string &paramName)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: TrafficLight.h:92
static std::vector< std::vector< TraCILink > > getControlledLinks(const std::string &tlsID)