SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSPushButton.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The class for a PushButton
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 #ifndef SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
22 #define SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
23 
24 #include <vector>
25 #include <map>
26 #include <string>
27 
28 class MSEdge;
29 class MSPhaseDefinition;
30 
34 class MSPushButton {
35 public:
36  virtual ~MSPushButton();
37 
42  virtual bool isActivated() const = 0;
43 
48  static bool anyActive(const std::vector<MSPushButton*>&);
49 protected:
55  MSPushButton(const MSEdge* edge, const MSEdge* crossingEdge);
56  const MSEdge* m_edge;
58 };
59 
64 public:
70  MSPedestrianPushButton(const MSEdge* walkingEdge, const MSEdge* crossingEdge);
72  }
73 
76  bool isActivated() const;
78 
84  static bool isActiveForEdge(const MSEdge* walkingEdge, const MSEdge* crossing);
85 
91  static bool isActiveOnAnySideOfTheRoad(const MSEdge* crossing);
92 
98  static std::vector<MSPushButton*> loadPushButtons(const MSPhaseDefinition*);
99 private:
100 // Map edge id -> list of crossing edges that crosses it
101  static std::map<std::string, std::vector<std::string> > m_crossingEdgeMap;
103 // Load the crossingEdgeMap
104  static void loadCrossingEdgeMap();
105 };
106 
107 #endif /* SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_ */
static void loadCrossingEdgeMap()
static std::map< std::string, std::vector< std::string > > m_crossingEdgeMap
Definition: MSPushButton.h:101
static bool anyActive(const std::vector< MSPushButton * > &)
Checks if any pushbutton in the vector is active.
virtual bool isActivated() const =0
Checks if the the pushbutton has been pressed.
static bool m_crossingEdgeMapLoaded
Definition: MSPushButton.h:102
A road/street connecting two junctions.
Definition: MSEdge.h:80
static bool isActiveOnAnySideOfTheRoad(const MSEdge *crossing)
Static method to check if the push button is active on both side of the road.
const MSEdge * m_edge
Definition: MSPushButton.h:56
const MSEdge * m_crossingEdge
Definition: MSPushButton.h:57
MSPedestrianPushButton(const MSEdge *walkingEdge, const MSEdge *crossingEdge)
virtual ~MSPedestrianPushButton()
Definition: MSPushButton.h:71
static std::vector< MSPushButton * > loadPushButtons(const MSPhaseDefinition *)
Loads all the pushbuttons for all the controlled lanes of a stage.
static bool isActiveForEdge(const MSEdge *walkingEdge, const MSEdge *crossing)
Static method with the same behavior of isActivated.
The definition of a single phase of a tls logic.
bool isActivated() const
abstract methods inherited from PedestrianState
virtual ~MSPushButton()
MSPushButton(const MSEdge *edge, const MSEdge *crossingEdge)