Eclipse SUMO - Simulation of Urban MObility
CastingFunctionBinding.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 CastingFunctionBinding_h
19 #define CastingFunctionBinding_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
36 template< class T, typename R, typename O >
38 public:
40  typedef O(T::* Operation)() const;
41 
42  CastingFunctionBinding(T* source, Operation operation, const R scale = 1) :
43  mySource(source),
44  myOperation(operation),
45  myScale(scale) {}
46 
49 
50  R getValue() const {
51  return myScale * (R)(mySource->*myOperation)();
52  }
53 
54  ValueSource<R>* copy() const {
56  }
57 
60  }
61 
62 private:
65 
68 
70  const R myScale;
71 
72 private:
75 
76 };
77 
78 
79 #endif
80 
81 /****************************************************************************/
82 
CastingFunctionBinding::myOperation
Operation myOperation
The object's operation to perform.
Definition: CastingFunctionBinding.h:67
CastingFunctionBinding
Definition: CastingFunctionBinding.h:37
CastingFunctionBinding::getValue
R getValue() const
Definition: CastingFunctionBinding.h:50
CastingFunctionBinding::copy
ValueSource< R > * copy() const
Definition: CastingFunctionBinding.h:54
CastingFunctionBinding::makedoubleReturningCopy
ValueSource< double > * makedoubleReturningCopy() const
Definition: CastingFunctionBinding.h:58
CastingFunctionBinding::~CastingFunctionBinding
~CastingFunctionBinding()
Destructor.
Definition: CastingFunctionBinding.h:48
CastingFunctionBinding::CastingFunctionBinding
CastingFunctionBinding(T *source, Operation operation, const R scale=1)
Definition: CastingFunctionBinding.h:42
CastingFunctionBinding::Operation
O(T::* Operation)() const
Type of the function to execute.
Definition: CastingFunctionBinding.h:40
CastingFunctionBinding::mySource
T * mySource
The object the action is directed to.
Definition: CastingFunctionBinding.h:64
ValueSource.h
CastingFunctionBinding::operator=
CastingFunctionBinding< T, R, O > & operator=(const CastingFunctionBinding< T, R, O > &)
invalidated assignment operator
config.h
ValueSource
Definition: ValueSource.h:32
CastingFunctionBinding::myScale
const R myScale
The scale to apply.
Definition: CastingFunctionBinding.h:70