SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // »missingDescription« 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef FuncBinding_StringParam_h 00022 #define FuncBinding_StringParam_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <utils/common/ValueSource.h> 00035 00036 00037 // =========================================================================== 00038 // class definitions 00039 // =========================================================================== 00043 template< class T, typename R > 00044 class FuncBinding_StringParam : public ValueSource<R> { 00045 public: 00047 typedef R(T::* Operation)(const std::string&) const; 00048 00049 FuncBinding_StringParam(T* source, Operation operation, 00050 const std::string& param) 00051 : 00052 mySource(source), 00053 myOperation(operation), 00054 myParam(param) {} 00055 00057 ~FuncBinding_StringParam() {} 00058 00059 R getValue() const { 00060 return (mySource->*myOperation)(myParam); 00061 } 00062 00063 ValueSource<R> *copy() const { 00064 return new FuncBinding_StringParam<T, R>( 00065 mySource, myOperation, myParam); 00066 } 00067 00068 ValueSource<SUMOReal> *makeSUMORealReturningCopy() const { 00069 throw 1; 00070 } 00071 00072 00073 protected: 00074 00075 private: 00077 T* mySource; 00078 00080 Operation myOperation; 00081 00082 std::string myParam; 00083 00084 }; 00085 00086 00087 #endif 00088 00089 /****************************************************************************/ 00090