SUMO - Simulation of Urban MObility
MSSOTLHiLevelTrafficLightLogic.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-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 /****************************************************************************/
19 #ifndef MSSOTLTrafficLightLogic_H
20 #define MSSOTLTrafficLightLogic_H
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 //#define SWARM_DEBUG
29 #include <vector>
30 #include "MSSOTLPolicy.h"
31 #include <stdlib.h>
32 #include <sstream>
33 
35 
46 public:
58  const std::string& id, const std::string& subid, const Phases& phases,
59  int step, SUMOTime delay,
60  const std::map<std::string, std::string>& parameters);
61 
74  const std::string& id, const std::string& subid, const Phases& phases,
75  int step, SUMOTime delay,
76  const std::map<std::string, std::string>& parameters,
77  MSSOTLSensors* sensors);
79 
83  std::vector<MSSOTLPolicy*>& getPolicies() {
84  return policies;
85  }
90  return currentPolicy;
91  }
92 
97  void init(NLDetectorBuilder& nb);
98 
99  /*
100  * \brief Adds a low-level policy to this high-level tll.
101  * \param[in] policy The low-level policy to be added.
102  */
103  void addPolicy(MSSOTLPolicy* policy);
104 
105  /*
106  * \brief Activates the given low-level policy.
107  * \param[in] policy The low-level policy to be activated.
108  */
109  void activate(MSSOTLPolicy* policy);
110 
111 protected:
112  virtual void decidePolicy() = 0;
113 
114 private:
115 
116  std::vector<MSSOTLPolicy*> policies;
118 
119 };
120 
121 #endif
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:36
void init(NLDetectorBuilder &nb)
Initialises the tls.
A self-organizing high-level traffic light logic.
A class that stores and controls tls and switching of their programs.
A self-organizing traffic light logic.
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
MSSOTLPolicy * getCurrentPolicy()
Returns the low-level policy currently selected by this high-level tll.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
MSSOTLHiLevelTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor without sensors passed.
Class for a low-level policy.
Definition: MSSOTLPolicy.h:65