SUMO - Simulation of Urban MObility
MSLaneSpeedTrigger.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Changes the speed allowed on a set of lanes
21 /****************************************************************************/
22 #ifndef MSLaneSpeedTrigger_h
23 #define MSLaneSpeedTrigger_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <vector>
37 #include <utils/common/Command.h>
40 #include "MSTrigger.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSLane;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
60 class MSLaneSpeedTrigger : public MSTrigger, public SUMOSAXHandler, public Command {
61 public:
69  MSLaneSpeedTrigger(const std::string& id,
70  const std::vector<MSLane*>& destLanes,
71  const std::string& file);
72 
73 
75  virtual ~MSLaneSpeedTrigger();
76 
77 
85  SUMOTime execute(SUMOTime currentTime);
86 
87 
88  SUMOTime processCommand(bool move2next, SUMOTime currentTime);
89 
90  double getDefaultSpeed() const;
91 
92  void setOverriding(bool val);
93 
94  void setOverridingValue(double val);
95 
96  double getLoadedSpeed();
97 
99  double getCurrentSpeed() const;
100 
101 protected:
103 
104 
112  virtual void myStartElement(int element,
113  const SUMOSAXAttributes& attrs);
114 
121  virtual void myEndElement(int element);
123 
124 
125 protected:
127  std::vector<MSLane*> myDestLanes;
128 
131 
134 
137 
140 
141  std::vector<std::pair<SUMOTime, double> > myLoadedSpeeds;
142  std::vector<std::pair<SUMOTime, double> >::iterator myCurrentEntry;
143 
144 private:
147 
150 
151  void init();
152 
153 
154 private:
156  bool myDidInit;
157 
158 };
159 
160 
161 #endif
162 
163 /****************************************************************************/
164 
std::vector< MSLane * > myDestLanes
MSLaneSpeedTrigger & operator=(const MSLaneSpeedTrigger &)
Invalidated assignment operator.
double myDefaultSpeed
The original speed allowed on the lanes.
double getCurrentSpeed() const
Returns the current speed.
std::vector< std::pair< SUMOTime, double > >::iterator myCurrentEntry
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOTime execute(SUMOTime currentTime)
Executes a switch command.
Base (microsim) event class.
Definition: Command.h:60
SAX-handler base for SUMO-files.
std::vector< std::pair< SUMOTime, double > > myLoadedSpeeds
Changes the speed allowed on a set of lanes.
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:47
Encapsulated SAX-Attributes.
bool myAmOverriding
The information whether the read speed shall be overridden.
MSLaneSpeedTrigger(const std::string &id, const std::vector< MSLane *> &destLanes, const std::string &file)
Constructor.
void setOverriding(bool val)
SUMOTime processCommand(bool move2next, SUMOTime currentTime)
virtual ~MSLaneSpeedTrigger()
Destructor.
double getDefaultSpeed() const
bool myDidInit
The information whether init was called.
long long int SUMOTime
Definition: TraCIDefs.h:51
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
virtual void myEndElement(int element)
Called on the closing of a tag;.
void setOverridingValue(double val)
double mySpeedOverrideValue
The speed to use if overriding the read speed.