SUMO - Simulation of Urban MObility
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-2017 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 
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
44 template< class T, typename R, typename O >
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 
57 
58  R getValue() const {
59  return myScale * (R)(mySource->*myOperation)();
60  }
61 
62  ValueSource<R>* copy() const {
64  }
65 
68  }
69 
70 private:
73 
76 
78  const R myScale;
79 
80 private:
83 
84 };
85 
86 
87 #endif
88 
89 /****************************************************************************/
90 
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)