SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FuncBinding_StringParam.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // »missingDescription«/****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. // SUMO is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // /****************************************************************************/ #ifndef FuncBinding_StringParam_h #define FuncBinding_StringParam_h // =========================================================================== // included modules // =========================================================================== #ifdef _MSC_VER #include <windows_config.h> #else #include <config.h> #endif #include <utils/common/ValueSource.h> // =========================================================================== // class definitions // =========================================================================== /** * @class FuncBinding_StringParam */ template< class T, typename R > class FuncBinding_StringParam : public ValueSource<R> { public: /// Type of the function to execute. typedef R(T::* Operation)(const std::string&) const; FuncBinding_StringParam(T* source, Operation operation, const std::string& param) : mySource(source), myOperation(operation), myParam(param) {} /// Destructor. ~FuncBinding_StringParam() {} R getValue() const { return (mySource->*myOperation)(myParam); } ValueSource<R>* copy() const { return new FuncBinding_StringParam<T, R>( mySource, myOperation, myParam); } ValueSource<SUMOReal>* makeSUMORealReturningCopy() const { throw 1; } protected: private: /// The object the action is directed to. T* mySource; /// The object's operation to perform. Operation myOperation; std::string myParam; }; #endif /****************************************************************************/
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef FuncBinding_StringParam_h
22 #define FuncBinding_StringParam_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
43 template< class T, typename R >
45 public:
47  typedef R(T::* Operation)(const std::string&) const;
48 
49  FuncBinding_StringParam(T* source, Operation operation,
50  const std::string& param)
51  :
52  mySource(source),
53  myOperation(operation),
54  myParam(param) {}
55 
58 
59  R getValue() const {
60  return (mySource->*myOperation)(myParam);
61  }
62 
63  ValueSource<R>* copy() const {
66  }
67 
69  throw 1;
70  }
71 
72 
73 protected:
74 
75 private:
78 
81 
82  std::string myParam;
83 
84 };
85 
86 
87 #endif
88 
89 /****************************************************************************/
90