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 /****************************************************************************/ 10 /// @file TrafficLight.h 11 /// @author Daniel Krajzewicz 12 /// @author Mario Krumnow 13 /// @author Michael Behrisch 14 /// @date 30.05.2012 15 /// @version $Id$ 16 /// 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> 30 #include <libsumo/TraCIConstants.h> 31 #ifndef SWIGJAVA 32 #ifndef SWIGPYTHON 33 #include <microsim/traffic_lights/MSTLLogicControl.h> 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 // =========================================================================== 49 /** 50 * @class TrafficLight 51 * @brief C++ TraCI client API implementation 52 */ 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 std::string getPhaseName(const std::string& tlsID); 67 static double getPhaseDuration(const std::string& tlsID); 68 static double getNextSwitch(const std::string& tlsID); 69 static std::string getParameter(const std::string& tlsID, const std::string& paramName); 70 71 static void setRedYellowGreenState(const std::string& tlsID, const std::string& state); 72 static void setPhase(const std::string& tlsID, const int index); 73 static void setPhaseName(const std::string& tlsID, const std::string& name); 74 static void setProgram(const std::string& tlsID, const std::string& programID); 75 static void setPhaseDuration(const std::string& tlsID, const double phaseDuration); 76 static void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCILogic& logic); 77 static void setParameter(const std::string& tlsID, const std::string& paramName, const std::string& value); 78 79 LIBSUMO_SUBSCRIPTION_API 80 81 static std::shared_ptr<VariableWrapper> makeWrapper(); 82 83 static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper); 84 85 private: 86 #ifndef SWIGJAVA 87 #ifndef SWIGPYTHON 88 static MSTLLogicControl::TLSLogicVariants& getTLS(const std::string& id); 89 #endif 90 #endif 91 92 private: 93 static SubscriptionResults mySubscriptionResults; 94 static ContextSubscriptionResults myContextSubscriptionResults; 95 96 /// @brief invalidated standard constructor 97 TrafficLight() = delete; 98 }; 99 100 101 } 102 103 104 #endif 105 106 /****************************************************************************/ 107