SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
CastingFunctionBinding.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// Function type template
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12
// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
#ifndef CastingFunctionBinding_h
23
#define CastingFunctionBinding_h
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#include <
utils/common/ValueSource.h
>
36
37
38
// ===========================================================================
39
// class definitions
40
// ===========================================================================
44
template
<
class
T,
typename
R,
typename
O >
45
class
CastingFunctionBinding
:
public
ValueSource
<R> {
46
public
:
48
typedef
O(T::*
Operation
)()
const
;
49
50
CastingFunctionBinding
(T* source,
Operation
operation,
const
R scale = 1) :
51
mySource
(source),
52
myOperation
(operation),
53
myScale
(scale) {}
54
56
~CastingFunctionBinding
() {}
57
58
R
getValue
()
const
{
59
return
myScale
* (R)(
mySource
->*
myOperation
)();
60
}
61
62
ValueSource<R>
*
copy
()
const
{
63
return
new
CastingFunctionBinding<T, R, O>
(
mySource
,
myOperation
,
myScale
);
64
}
65
66
ValueSource<SUMOReal>
*
makeSUMORealReturningCopy
()
const
{
67
return
new
CastingFunctionBinding<T, SUMOReal, O>
(
mySource
,
myOperation
,
myScale
);
68
}
69
70
private
:
72
T*
mySource
;
73
75
Operation
myOperation
;
76
78
const
R
myScale
;
79
80
private
:
82
CastingFunctionBinding<T, R, O>
&
operator=
(
const
CastingFunctionBinding<T, R, O>
&);
83
84
};
85
86
87
#endif
88
89
/****************************************************************************/
90
CastingFunctionBinding::getValue
R getValue() const
Definition:
CastingFunctionBinding.h:58
windows_config.h
CastingFunctionBinding::makeSUMORealReturningCopy
ValueSource< SUMOReal > * makeSUMORealReturningCopy() const
Definition:
CastingFunctionBinding.h:66
ValueSource.h
config.h
CastingFunctionBinding::~CastingFunctionBinding
~CastingFunctionBinding()
Destructor.
Definition:
CastingFunctionBinding.h:56
CastingFunctionBinding::mySource
T * mySource
The object the action is directed to.
Definition:
CastingFunctionBinding.h:72
ValueSource
Definition:
ValueSource.h:41
CastingFunctionBinding::myOperation
Operation myOperation
The object's operation to perform.
Definition:
CastingFunctionBinding.h:75
CastingFunctionBinding::myScale
const R myScale
The scale to apply.
Definition:
CastingFunctionBinding.h:78
CastingFunctionBinding::operator=
CastingFunctionBinding< T, R, O > & operator=(const CastingFunctionBinding< T, R, O > &)
invalidated assignment operator
CastingFunctionBinding::CastingFunctionBinding
CastingFunctionBinding(T *source, Operation operation, const R scale=1)
Definition:
CastingFunctionBinding.h:50
CastingFunctionBinding
Definition:
CastingFunctionBinding.h:45
CastingFunctionBinding::Operation
O(T::* Operation)() const
Type of the function to execute.
Definition:
CastingFunctionBinding.h:48
CastingFunctionBinding::copy
ValueSource< R > * copy() const
Definition:
CastingFunctionBinding.h:62
src
microsim
logging
CastingFunctionBinding.h
Generated on Fri Aug 12 2016 18:34:54 for SUMO - Simulation of Urban MObility by
1.8.11