SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FuncBinding_IntParam.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-2015 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 FuncBinding_IntParam_h
23 #define FuncBinding_IntParam_h
24 
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
45 template< class T, typename R >
46 class FuncBinding_IntParam : public ValueSource<R> {
47 public:
49  typedef R(T::* Operation)(int) const;
50 
51  FuncBinding_IntParam(T* source, Operation operation,
52  size_t param)
53  :
54  mySource(source),
55  myOperation(operation),
56  myParam(param) {}
57 
60 
61  SUMOReal getValue() const {
62  return (mySource->*myOperation)(myParam);
63  }
64 
65  ValueSource<R>* copy() const {
66  return new FuncBinding_IntParam<T, R>(
68  }
69 
72  }
73 
74 protected:
75 
76 private:
79 
82 
83  int myParam;
84 
85 };
86 
87 
88 #endif
89 
90 /****************************************************************************/
91 
ValueSource< R > * copy() const
~FuncBinding_IntParam()
Destructor.
R(T::* Operation)(int) const
Type of the function to execute.
Operation myOperation
The object's operation to perform.
ValueSource< SUMOReal > * makeSUMORealReturningCopy() const
T * mySource
The object the action is directed to.
SUMOReal getValue() const
FuncBinding_IntParam(T *source, Operation operation, size_t param)
#define SUMOReal
Definition: config.h:218