SUMO - Simulation of Urban MObility
MSLaneSpeedTrigger.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Changes the speed allowed on a set of lanes
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSLaneSpeedTrigger_h
24 #define MSLaneSpeedTrigger_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <vector>
38 #include <utils/common/Command.h>
41 #include "MSTrigger.h"
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MSLane;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
61 class MSLaneSpeedTrigger : public MSTrigger, public SUMOSAXHandler, public Command {
62 public:
70  MSLaneSpeedTrigger(const std::string& id,
71  const std::vector<MSLane*>& destLanes,
72  const std::string& file);
73 
74 
76  virtual ~MSLaneSpeedTrigger();
77 
78 
86  SUMOTime execute(SUMOTime currentTime);
87 
88 
89  SUMOTime processCommand(bool move2next, SUMOTime currentTime);
90 
91  double getDefaultSpeed() const;
92 
93  void setOverriding(bool val);
94 
95  void setOverridingValue(double val);
96 
97  double getLoadedSpeed();
98 
100  double getCurrentSpeed() const;
101 
102 protected:
104 
105 
113  virtual void myStartElement(int element,
114  const SUMOSAXAttributes& attrs);
115 
122  virtual void myEndElement(int element);
124 
125 
126 protected:
128  std::vector<MSLane*> myDestLanes;
129 
132 
135 
138 
141 
142  std::vector<std::pair<SUMOTime, double> > myLoadedSpeeds;
143  std::vector<std::pair<SUMOTime, double> >::iterator myCurrentEntry;
144 
145 private:
148 
151 
152  void init();
153 
154 
155 private:
157  bool myDidInit;
158 
159 };
160 
161 
162 #endif
163 
164 /****************************************************************************/
165 
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:61
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:48
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:52
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
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.