Eclipse 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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 //#define SWARM_DEBUG
27 #include <vector>
28 #include "MSSOTLPolicy.h"
29 #include <stdlib.h>
30 #include <sstream>
31 
33 
44 public:
56  const std::string& id, const std::string& programID,
57  const TrafficLightType logicType, const Phases& phases,
58  int step, SUMOTime delay,
59  const std::map<std::string, std::string>& parameters);
60 
73  const std::string& id, const std::string& programID,
74  const TrafficLightType logicType, 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 
long long int SUMOTime
Definition: SUMOTime.h:31
TrafficLightType
A self-organizing high-level traffic light logic.
MSSOTLHiLevelTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const TrafficLightType logicType, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor without sensors passed.
MSSOTLPolicy * getCurrentPolicy()
Returns the low-level policy currently selected by this high-level tll.
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
void init(NLDetectorBuilder &nb)
Initialises the tls.
Class for a low-level policy.
Definition: MSSOTLPolicy.h:63
A self-organizing traffic light logic.
A class that stores and controls tls and switching of their programs.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Builds detectors for microsim.