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