SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSEventControl.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Stores time-dependant events and executes them at the proper time
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 MSEventControl_h
24 #define MSEventControl_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 <utility>
37 #include <queue>
38 #include <vector>
39 #include <map>
40 #include <utils/common/SUMOTime.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class Command;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
58 public:
60  typedef std::pair< Command*, SUMOTime > Event;
61 
62 
67  enum AdaptType {
72  };
73 
74 
75 public:
78 
79 
81  virtual ~MSEventControl();
82 
83 
98  virtual SUMOTime addEvent(Command* operation, SUMOTime execTimeStep,
99  AdaptType type);
100 
101 
119  virtual void execute(SUMOTime time);
120 
121 
126  bool isEmpty();
127 
128 
135  void setCurrentTimeStep(SUMOTime time);
136 
137 
138 protected:
144  public:
146  bool operator()(const Event& e1, const Event& e2) const {
147  return e1.second > e2.second;
148  }
149  };
150 
151 
152 private:
154  typedef std::priority_queue< Event, std::vector< Event >, EventSortCrit > EventCont;
155 
158 
161 
164 
165 
166 private:
169 
172 
173 
174 };
175 
176 
177 #endif
178 
179 /****************************************************************************/
180