00001 // $Id: membind.hh 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2006 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00050 #ifndef HH_SENF_Utils_membind_ 00051 #define HH_SENF_Utils_membind_ 1 00052 00053 // Custom includes 00054 #include <boost/bind.hpp> 00055 #include <boost/function.hpp> 00056 #include <senf/config.hh> 00057 00058 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00059 00080 #define SENF_FNP(ret, fn, args) \ 00081 static_cast<ret (*) args>(& fn) 00082 00109 #define SENF_MEMFNP(ret, cls, fn, args) \ 00110 static_cast<ret (cls::*) args>(& cls :: fn) 00111 00146 #define SENF_MEMBINDFNP(ret, cls, fn, args) \ 00147 senf::membind(SENF_MEMFNP(ret, cls, fn, args), this) 00148 00149 namespace senf { 00150 00151 #define scOBTYPE * 00152 #include <senf/Utils/impl/membind.hh> 00153 #undef scOBTYPE 00154 00155 #define scOBTYPE & 00156 #include <senf/Utils/impl/membind.hh> 00157 #undef scOBTYPE 00158 00159 #ifdef DOXYGEN 00160 00162 //\{ 00163 00174 template <typename R, typename T, typename Args> 00175 boost::function<R (Args)> membind(R (T::* fn)( Args ), T * ob); 00176 00177 //\} 00178 00179 #endif 00180 00181 } 00182 00183 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00184 //#include "membind.cci" 00185 //#include "membind.ct" 00186 //#include "membind.cti" 00187 #endif 00188 00189 00190 // Local Variables: 00191 // mode: c++ 00192 // fill-column: 100 00193 // c-file-style: "senf" 00194 // indent-tabs-mode: nil 00195 // ispell-local-dictionary: "american" 00196 // compile-command: "scons -u test" 00197 // comment-column: 40 00198 // End: