SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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.sourceforge.net/
13
// Copyright (C) 2001-2012 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
>
41
#include <
utils/common/UtilExceptions.h
>
42
43
44
// ===========================================================================
45
// class declarations
46
// ===========================================================================
47
class
Command
;
48
49
50
// ===========================================================================
51
// class definitions
52
// ===========================================================================
57
class
MSEventControl
{
58
public
:
60
typedef
std::pair< Command*, SUMOTime >
Event
;
61
62
67
enum
AdaptType
{
69
ADAPT_AFTER_EXECUTION
= 1,
71
NO_CHANGE
= 2
72
};
73
74
75
public
:
77
MSEventControl
();
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
:
143
class
EventSortCrit
{
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
157
SUMOTime
currentTimeStep
;
158
160
EventCont
myEvents
;
161
163
SUMOTime
getCurrentTimeStep
();
164
165
166
private
:
168
MSEventControl
(
const
MSEventControl
&);
169
171
MSEventControl
&
operator=
(
const
MSEventControl
&);
172
173
174
};
175
176
177
#endif
178
179
/****************************************************************************/
180
build
buildd
sumo-0.16.0~dfsg
src
microsim
MSEventControl.h
Generated on Tue Apr 16 2013 01:32:17 for SUMO - Simulation of Urban MObility by
1.8.3.1