SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
13 // Copyright (C) 2001-2014 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