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
StaticCommand.h
Go to the documentation of this file.
1
/****************************************************************************/
8
// A wrapper for a Command function
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef StaticCommand_h
22
#define StaticCommand_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include "
Command.h
"
35
36
37
// ===========================================================================
38
// class definition
39
// ===========================================================================
48
template
<
class
T >
49
class
StaticCommand
:
public
Command
{
50
public
:
52
typedef
SUMOTime
(*
Operation
)(
SUMOTime
);
53
54
55
public
:
62
StaticCommand
(
Operation
operation)
63
:
myOperation
(operation),
myAmDescheduledByParent
(false) {}
64
65
67
~StaticCommand
() {}
68
69
75
void
deschedule
() {
76
myAmDescheduledByParent
=
true
;
77
}
78
79
80
83
93
SUMOTime
execute
(
SUMOTime
currentTime) {
94
// do not execute if the command was descheduled
95
if
(
myAmDescheduledByParent
) {
96
return
0;
97
}
98
// execute if stil valid
99
return
(*
myOperation
)(currentTime);
100
}
102
103
104
private
:
106
Operation
myOperation
;
107
109
bool
myAmDescheduledByParent
;
110
111
112
};
113
114
115
#endif
116
117
/****************************************************************************/
118
tmp
buildd
sumo-0.15.0~dfsg
src
utils
common
StaticCommand.h
Generated on Sun May 27 2012 14:52:11 for SUMO - Simulation of Urban MObility by
1.8.1