Eclipse SUMO - Simulation of Urban MObility
FuncBinding_IntParam.h
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
17
// �Function type template
18
/****************************************************************************/
19
#ifndef FuncBinding_IntParam_h
20
#define FuncBinding_IntParam_h
21
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#include <
config.h
>
28
29
#include <
utils/common/ValueSource.h
>
30
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
38
template
<
class
T,
typename
R >
39
class
FuncBinding_IntParam
:
public
ValueSource
<R> {
40
public
:
42
typedef
R(T::*
Operation
)(int)
const
;
43
44
FuncBinding_IntParam
(T* source,
Operation
operation,
45
int
param)
46
:
47
mySource
(source),
48
myOperation
(operation),
49
myParam
(param) {}
50
52
~FuncBinding_IntParam
() {}
53
54
double
getValue
()
const
{
55
return
(
mySource
->*
myOperation
)(
myParam
);
56
}
57
58
ValueSource<R>
*
copy
()
const
{
59
return
new
FuncBinding_IntParam<T, R>
(
60
mySource
,
myOperation
,
myParam
);
61
}
62
63
ValueSource<double>
*
makedoubleReturningCopy
()
const
{
64
return
new
FuncBinding_IntParam<T, double>
(
mySource
,
myOperation
,
myParam
);
65
}
66
67
protected
:
68
69
private
:
71
T*
mySource
;
72
74
Operation
myOperation
;
75
76
int
myParam
;
77
78
};
79
80
81
#endif
82
83
/****************************************************************************/
84
FuncBinding_IntParam::myParam
int myParam
Definition:
FuncBinding_IntParam.h:76
FuncBinding_IntParam
Definition:
FuncBinding_IntParam.h:39
FuncBinding_IntParam::copy
ValueSource< R > * copy() const
Definition:
FuncBinding_IntParam.h:58
FuncBinding_IntParam::FuncBinding_IntParam
FuncBinding_IntParam(T *source, Operation operation, int param)
Definition:
FuncBinding_IntParam.h:44
FuncBinding_IntParam::myOperation
Operation myOperation
The object's operation to perform.
Definition:
FuncBinding_IntParam.h:74
FuncBinding_IntParam::~FuncBinding_IntParam
~FuncBinding_IntParam()
Destructor.
Definition:
FuncBinding_IntParam.h:52
FuncBinding_IntParam::getValue
double getValue() const
Definition:
FuncBinding_IntParam.h:54
FuncBinding_IntParam::makedoubleReturningCopy
ValueSource< double > * makedoubleReturningCopy() const
Definition:
FuncBinding_IntParam.h:63
ValueSource.h
config.h
ValueSource
Definition:
ValueSource.h:33
FuncBinding_IntParam::Operation
R(T::* Operation)(int) const
Type of the function to execute.
Definition:
FuncBinding_IntParam.h:42
FuncBinding_IntParam::mySource
T * mySource
The object the action is directed to.
Definition:
FuncBinding_IntParam.h:71
src
microsim
logging
FuncBinding_IntParam.h
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16