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-2015 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  SUMOReal getDefaultSpeed() const;
92 
93  void setOverriding(bool val);
94 
95  void setOverridingValue(SUMOReal val);
96 
98 
100  SUMOReal 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, SUMOReal> > myLoadedSpeeds;
143  std::vector<std::pair<SUMOTime, SUMOReal> >::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 
void setOverridingValue(SUMOReal val)
std::vector< MSLane * > myDestLanes
MSLaneSpeedTrigger & operator=(const MSLaneSpeedTrigger &)
Invalidated assignment operator.
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.
Changes the speed allowed on a set of lanes.
SUMOReal getCurrentSpeed() const
Returns the current speed.
SUMOReal myDefaultSpeed
The original speed allowed on the lanes.
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:48
Encapsulated SAX-Attributes.
SUMOReal getDefaultSpeed() const
bool myAmOverriding
The information whether the read speed shall be overridden.
std::vector< std::pair< SUMOTime, SUMOReal > >::iterator myCurrentEntry
void setOverriding(bool val)
MSLaneSpeedTrigger(const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Constructor.
SUMOReal mySpeedOverrideValue
The speed to use if overriding the read speed.
SUMOTime processCommand(bool move2next, SUMOTime currentTime)
int SUMOTime
Definition: SUMOTime.h:43
virtual ~MSLaneSpeedTrigger()
Destructor.
std::vector< std::pair< SUMOTime, SUMOReal > > myLoadedSpeeds
bool myDidInit
The information whether init was called.
#define SUMOReal
Definition: config.h:218
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
virtual void myEndElement(int element)
Called on the closing of a tag;.