Eclipse SUMO - Simulation of Urban MObility
FuncBinding_StringParam.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
/****************************************************************************/
16
// Function type template
17
/****************************************************************************/
18
#ifndef FuncBinding_StringParam_h
19
#define FuncBinding_StringParam_h
20
21
22
// ===========================================================================
23
// included modules
24
// ===========================================================================
25
#include <
config.h
>
26
27
#include <
utils/common/ValueSource.h
>
28
29
30
// ===========================================================================
31
// class definitions
32
// ===========================================================================
36
template
<
class
T,
typename
R >
37
class
FuncBinding_StringParam
:
public
ValueSource
<R> {
38
public
:
40
typedef
R(T::*
Operation
)(
const
std::string&)
const
;
41
42
FuncBinding_StringParam
(T* source,
Operation
operation,
43
const
std::string& param)
44
:
45
mySource
(source),
46
myOperation
(operation),
47
myParam
(param) {}
48
50
~FuncBinding_StringParam
() {}
51
52
R
getValue
()
const
{
53
return
(
mySource
->*
myOperation
)(
myParam
);
54
}
55
56
ValueSource<R>
*
copy
()
const
{
57
return
new
FuncBinding_StringParam<T, R>
(
58
mySource
,
myOperation
,
myParam
);
59
}
60
61
ValueSource<double>
*
makedoubleReturningCopy
()
const
{
62
throw
1;
63
}
64
65
66
protected
:
67
68
private
:
70
T*
mySource
;
71
73
Operation
myOperation
;
74
75
std::string
myParam
;
76
77
};
78
79
80
#endif
81
82
/****************************************************************************/
83
FuncBinding_StringParam::FuncBinding_StringParam
FuncBinding_StringParam(T *source, Operation operation, const std::string ¶m)
Definition:
FuncBinding_StringParam.h:42
FuncBinding_StringParam::myOperation
Operation myOperation
The object's operation to perform.
Definition:
FuncBinding_StringParam.h:73
FuncBinding_StringParam::getValue
R getValue() const
Definition:
FuncBinding_StringParam.h:52
FuncBinding_StringParam::mySource
T * mySource
The object the action is directed to.
Definition:
FuncBinding_StringParam.h:70
FuncBinding_StringParam::makedoubleReturningCopy
ValueSource< double > * makedoubleReturningCopy() const
Definition:
FuncBinding_StringParam.h:61
FuncBinding_StringParam::copy
ValueSource< R > * copy() const
Definition:
FuncBinding_StringParam.h:56
FuncBinding_StringParam::~FuncBinding_StringParam
~FuncBinding_StringParam()
Destructor.
Definition:
FuncBinding_StringParam.h:50
ValueSource.h
FuncBinding_StringParam::myParam
std::string myParam
Definition:
FuncBinding_StringParam.h:75
FuncBinding_StringParam::Operation
R(T::* Operation)(const std::string &) const
Type of the function to execute.
Definition:
FuncBinding_StringParam.h:40
config.h
ValueSource
Definition:
ValueSource.h:33
FuncBinding_StringParam
Definition:
FuncBinding_StringParam.h:37
src
microsim
logging
FuncBinding_StringParam.h
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16