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