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-2018 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 CastingFunctionBinding_h
20 #define CastingFunctionBinding_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
37 template< class T, typename R, typename O >
39 public:
41  typedef O(T::* Operation)() const;
42 
43  CastingFunctionBinding(T* source, Operation operation, const R scale = 1) :
44  mySource(source),
45  myOperation(operation),
46  myScale(scale) {}
47 
50 
51  R getValue() const {
52  return myScale * (R)(mySource->*myOperation)();
53  }
54 
55  ValueSource<R>* copy() const {
57  }
58 
61  }
62 
63 private:
66 
69 
71  const R myScale;
72 
73 private:
76 
77 };
78 
79 
80 #endif
81 
82 /****************************************************************************/
83 
O(T::* Operation)() const
Type of the function to execute.
T * mySource
The object the action is directed to.
ValueSource< R > * copy() const
Operation myOperation
The object&#39;s operation to perform.
const R myScale
The scale to apply.
CastingFunctionBinding< T, R, O > & operator=(const CastingFunctionBinding< T, R, O > &)
invalidated assignment operator
ValueSource< double > * makedoubleReturningCopy() const
CastingFunctionBinding(T *source, Operation operation, const R scale=1)