|
Boost-Commit : |
From: mconsoni_at_[hidden]
Date: 2007-07-05 20:40:13
Author: mconsoni
Date: 2007-07-05 20:40:12 EDT (Thu, 05 Jul 2007)
New Revision: 7373
URL: http://svn.boost.org/trac/boost/changeset/7373
Log:
- added preprocessor macros for shared_library's get_functor method.
Text files modified:
sandbox/boost/extension/shared_library.hpp | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
Modified: sandbox/boost/extension/shared_library.hpp
==============================================================================
--- sandbox/boost/extension/shared_library.hpp (original)
+++ sandbox/boost/extension/shared_library.hpp 2007-07-05 20:40:12 EDT (Thu, 05 Jul 2007)
@@ -84,11 +84,13 @@
/// Declaration of functor class template.
template <class ReturnValue,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), class Param, void)>
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(\
+ BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), class Param, void)>\
class functor;
/// Functor template specializations.
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), BOOST_EXTENSION_FUNCTOR_CLASS, _)
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
+ BOOST_EXTENSION_FUNCTOR_CLASS, _)
#undef BOOST_EXTENSION_FUNCTOR_CLASS
#else
@@ -291,6 +293,26 @@
bool open(){return (handle_ = load_shared_library(location_.c_str())) != 0;}
bool close(){return close_shared_library(handle_);}
+#ifdef BOOST_EXTENSION_USE_PP
+
+#define BOOST_EXTENSION_GET_FUNCTOR_METHOD(Z, N, _) \
+ template <class ReturnValue BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_PARAMS(N, class Param) > \
+ functor<ReturnValue BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_PARAMS(N, Param) > \
+ get_functor(const char * function_name) \
+ { \
+ return functor<ReturnValue BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_PARAMS(N, Param)> \
+ (get_function(handle_, function_name)); \
+ } \
+ /**/
+
+ BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
+ BOOST_EXTENSION_GET_FUNCTOR_METHOD, _)
+
+#undef BOOST_EXTENSION_GET_FUNCTOR_METHOD
+#else
template <class ReturnValue>
functor<ReturnValue>
get_functor(const char * function_name)
@@ -344,6 +366,8 @@
Param6>
(get_function(handle_, function_name));
}
+#endif // BOOST_EXTENSION_USE_PP
+
shared_library(const char * location, bool auto_close = false)
:location_(location), handle_(0), auto_close_(auto_close){}
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk