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
WrappingCommand.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-2013 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 WrappingCommand_h
22
#define WrappingCommand_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
// ===========================================================================
59
template
<
class
T >
60
class
WrappingCommand
:
public
Command
{
61
public
:
63
typedef
SUMOTime
(T::*
Operation
)(
SUMOTime
);
64
65
66
public
:
73
WrappingCommand
(T* receiver,
Operation
operation)
74
:
myReceiver
(receiver),
myOperation
(operation),
75
myAmDescheduledByParent
(false) {}
76
77
79
~WrappingCommand
() {}
80
81
87
void
deschedule
() {
88
myAmDescheduledByParent
=
true
;
89
}
90
91
92
95
105
SUMOTime
execute
(
SUMOTime
currentTime) {
106
// do not execute if the command was descheduled
107
if
(
myAmDescheduledByParent
) {
108
return
0;
109
}
110
// execute if stil valid
111
return
(
myReceiver
->*
myOperation
)(currentTime);
112
}
114
115
116
private
:
118
T*
myReceiver
;
119
121
Operation
myOperation
;
122
124
bool
myAmDescheduledByParent
;
125
126
127
};
128
129
130
#endif
131
132
/****************************************************************************/
133
build
buildd
sumo-0.17.1~dfsg
src
utils
common
WrappingCommand.h
Generated on Sun Jun 16 2013 17:30:20 for SUMO - Simulation of Urban MObility by
1.8.3.1